2017-08-09 04:23:19 +00:00
|
|
|
app.controller('HomeController', ['$scope', 'Auth', 'localStorageService', '$location', function ($scope, Auth, localStorageService, $location) {
|
2017-08-09 17:28:36 +00:00
|
|
|
var vm = this;
|
2017-08-09 04:23:19 +00:00
|
|
|
|
2017-08-09 17:28:36 +00:00
|
|
|
vm.signOut = function () {
|
|
|
|
localStorageService.remove('userAuth');
|
|
|
|
$location.path('/splash-page');
|
|
|
|
}
|
|
|
|
|
|
|
|
function userAuth() {
|
|
|
|
return JSON.parse(localStorageService.get('userAuth'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.$watch(Auth.isLoggedIn, function (value, oldValue) {
|
|
|
|
if (!value && !oldValue) {
|
|
|
|
$location.path('/splash-page');
|
|
|
|
}
|
|
|
|
}, true);
|
2017-08-08 06:35:11 +00:00
|
|
|
|
2017-08-08 20:54:25 +00:00
|
|
|
}]);
|