22 lines
593 B
JavaScript
Raw Normal View History

2017-08-14 12:41:55 -06:00
app.factory('Auth', ['localStorageService', '$location', '$rootScope', function(localStorageService, $location, $rootScope) {
2017-08-09 12:41:43 -06:00
var user;
return{
2017-08-11 09:09:41 -06:00
setUser: function(currentUser){
2017-08-09 12:41:43 -06:00
user = currentUser;
2017-08-10 16:33:54 -06:00
if (redirectedURL === '/splash-page') {
2017-08-11 15:37:06 -06:00
$location.path('/home');
2017-08-10 16:33:54 -06:00
} else {
2017-08-11 15:37:06 -06:00
$location.path('/' + redirectedURL);
2017-08-10 16:33:54 -06:00
}
2017-08-09 12:41:43 -06:00
},
2017-08-11 09:09:41 -06:00
isLoggedIn: function(){
2017-08-09 12:41:43 -06:00
user = JSON.parse(localStorageService.get('userAuth'));
return (user) ? user : false;
2017-08-11 09:09:41 -06:00
},
getProfile: function(profile) {
profile = user;
return profile;
2017-08-09 12:41:43 -06:00
}
};
2017-08-08 22:23:19 -06:00
}]);