walnut_launchpad.html/js/services/auth.js

22 lines
593 B
JavaScript

app.factory('Auth', ['localStorageService', '$location', '$rootScope', function(localStorageService, $location, $rootScope) {
var user;
return{
setUser: function(currentUser){
user = currentUser;
if (redirectedURL === '/splash-page') {
$location.path('/home');
} else {
$location.path('/' + redirectedURL);
}
},
isLoggedIn: function(){
user = JSON.parse(localStorageService.get('userAuth'));
return (user) ? user : false;
},
getProfile: function(profile) {
profile = user;
return profile;
}
};
}]);