Hey there! I'm currently working on a piece of code that is designed to check if there are any users in the database. If it detects any users, it will display a list of them on a specific view. However, if there are no users found, it should redirect to a view where new user creation form is available. Unfortunately, the current logic for checking seems to be failing and I can't figure out what's going wrong.
users = Users.query();
users.$promise.then(
function (data) {
if (!data) {
$location.url('/NewUser')
} else {
$location.url('/UsersList')
}
});