update of user data after submission

parent 0d19a06f
......@@ -18,6 +18,7 @@ function LoginCtrl(
$stateParams,
$timeout,
ngToast,
user,
CONSTANTS,
vcRecaptchaService) {
......@@ -77,7 +78,7 @@ function LoginCtrl(
// user is in the scope of the MainCtrl
data.user.name = data.user.name || $translate.instant('name');
data.user.surname = data.user.surname || $translate.instant('surname');
$scope.user = JSON.parse(JSON.stringify(data.user));
$window.sessionStorage.user = JSON.stringify(data.user);
$location.path('/students');
})
......
......@@ -31,6 +31,14 @@ module.factory('AuthInterceptorService', function ($rootScope, $q, $window) {
};
});
/**
* 'user' service, to make user information persists through ui-route
* This is a more convenient way that user $window.sessionStorage
*/
module.factory("user",function(){
return {};
});
// Add AuthInterceptorService to $httpProvider.interceptors
module.config(function ($httpProvider) {
$httpProvider.interceptors.push('AuthInterceptorService');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment