refactor: switch auth data from localStorage to sessionStorage
Aligns user and permissions storage with the existing sessionStorage-based token model. Eliminates the dual-write pattern and stale cross-session data.
This commit is contained in:
@@ -92,7 +92,7 @@ function addCredentialModal() {
|
||||
setModalProcessing(true);
|
||||
refreshModals();
|
||||
|
||||
const user = JSON.parse(localStorage.getItem('vw:user') || 'null');
|
||||
const user = JSON.parse(sessionStorage.getItem('vw:user') || 'null');
|
||||
const username = user?.username || '';
|
||||
if (!username) {
|
||||
toast('Username not available', 'error');
|
||||
|
||||
@@ -21,12 +21,12 @@ const SUBSYSTEMS = [
|
||||
];
|
||||
|
||||
function currentUser() {
|
||||
const u = JSON.parse(localStorage.getItem('vw:user') || 'null');
|
||||
const u = JSON.parse(sessionStorage.getItem('vw:user') || 'null');
|
||||
return u ? u.username : '';
|
||||
}
|
||||
|
||||
function hasAuthAdmin() {
|
||||
const perms = JSON.parse(localStorage.getItem('vw:permissions') || 'null');
|
||||
const perms = JSON.parse(sessionStorage.getItem('vw:permissions') || 'null');
|
||||
return perms && perms.auth === 'rw';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user