walnut_launchpad.html/js/services/auth.js

23 lines
667 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);
}
console.log("%c" + redirectedURL, "color: blue; font-size: 14px;");
},
isLoggedIn: function(){
user = JSON.parse(localStorageService.get('userAuth'));
return (user) ? user : false;
},
getProfile: function(profile) {
profile = user;
return profile;
}
};
}]);