walnut_launchpad.html/js/services/auth.js

26 lines
646 B
JavaScript

app.factory('Auth', ['localStorageService', '$location', function(localStorageService, $location) {
var user;
return{
setUser: function(currentUser){
user = currentUser;
// console.log("%c" + redirectedURL, "color: red; font-size: 72px;");
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;
}
};
}]);