update of user data after submission

parent ceec4332
...@@ -62,7 +62,7 @@ function LoginCtrl( ...@@ -62,7 +62,7 @@ function LoginCtrl(
.success(function (data) { .success(function (data) {
$window.sessionStorage.token = data.token; $window.sessionStorage.token = data.token;
// User data correct //User data correct
if (data.user) { if (data.user) {
// Adapt language en-us to en-gb (the latter is the one supported for 'en') // Adapt language en-us to en-gb (the latter is the one supported for 'en')
if (data.user.lang === 'en-us') if (data.user.lang === 'en-us')
...@@ -74,6 +74,9 @@ function LoginCtrl( ...@@ -74,6 +74,9 @@ function LoginCtrl(
$location.path('/sup/login'); $location.path('/sup/login');
} }
// user is in the scope of the MainCtrl
$scope.user = JSON.parse(JSON.stringify(data.user));
$window.sessionStorage.user = JSON.stringify(data.user); $window.sessionStorage.user = JSON.stringify(data.user);
$location.path('/students'); $location.path('/students');
}) })
......
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