Username replaced with Alias comming from the Users Module
This commit is contained in:
1 parent
8db1909628
commit
453f2fd5f3
2 files changed
+15
-1
No files matched your search
+12
-1
@@ -24,7 +24,18 @@ function newEndUser() {
|
||||
|
||||
function initialize() {
|
||||
|
||||
window.USER_LOGGED_IN = window.USER_PROFILE.userName;
|
||||
let storedUser = window.localStorage.getItem('loggedInUser');
|
||||
|
||||
if (storedUser === null || storedUser === "") {
|
||||
|
||||
// User is currently not logged in.
|
||||
window.USER_LOGGED_IN = "";
|
||||
return;
|
||||
}
|
||||
|
||||
let loggedInUser = JSON.parse(storedUser);
|
||||
|
||||
window.USER_LOGGED_IN = loggedInUser.alias;
|
||||
|
||||
/* Here we will rearrange the storage permissions array into a map, so that it can be easily consumed when needed. */
|
||||
|
||||
|
||||
@@ -134,6 +134,7 @@ function newLogin() {
|
||||
console.log("apolloClient data", response);
|
||||
let sessionToken = response.data.userByAuthId.sessionToken;
|
||||
window.localStorage.setItem('sessionToken', sessionToken);
|
||||
window.localStorage.setItem('loggedInUser', JSON.stringify(response.data.userByAuthId));
|
||||
window.location = "/index.html?" + sessionToken;
|
||||
})
|
||||
.catch(error => console.error("apolloClient error", error));
|
||||
@@ -153,6 +154,7 @@ function newLogin() {
|
||||
if (sessionToken !== null && sessionToken !== "") {
|
||||
|
||||
window.localStorage.setItem('sessionToken', "");
|
||||
window.localStorage.setItem('loggedInUser', "");
|
||||
window.location = "/index.html";
|
||||
currentLabel = "Login / Signup";
|
||||
|
||||
@@ -172,6 +174,7 @@ function newLogin() {
|
||||
/* Goes for a logout */
|
||||
|
||||
window.localStorage.setItem('sessionToken', "");
|
||||
window.localStorage.setItem('loggedInUser', "");
|
||||
window.location = "/index.html";
|
||||
currentLabel = "Login / Signup";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user