Skip to content

Instantly share code, notes, and snippets.

@gocreating
Created August 5, 2014 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gocreating/070b1ab4f2ea40c5e9c5 to your computer and use it in GitHub Desktop.
Save gocreating/070b1ab4f2ea40c5e9c5 to your computer and use it in GitHub Desktop.
// service.js
.factory('authService', ['$http', '$route', function ($http, $route) {
var auth = {
isAuth: false,
user: null
};
$http
.get('/api/session')
.success(function (data) {
auth.isAuth = data.value.isAuth;
auth.user = data.value.user;
$route.reload();
});
return auth;
}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment