forked from verdnatura/salix-front
perf(lilium): refs #6930 Improve setToken fn
This commit is contained in:
parent
b95d44c05d
commit
37ad84f239
|
@ -23,13 +23,9 @@ export function useSession() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setToken(data) {
|
function setToken(data) {
|
||||||
if (data.keepLogin) {
|
const storage = data.keepLogin ? localStorage : sessionStorage;
|
||||||
localStorage.setItem(TOKEN, data.token);
|
storage.setItem(TOKEN, data.token);
|
||||||
localStorage.setItem(TOKEN_MULTIMEDIA, data.tokenMultimedia);
|
storage.setItem(TOKEN_MULTIMEDIA, data.tokenMultimedia);
|
||||||
} else {
|
|
||||||
sessionStorage.setItem(TOKEN, data.token);
|
|
||||||
sessionStorage.setItem(TOKEN_MULTIMEDIA, data.tokenMultimedia);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
async function destroyToken(url, storage, key) {
|
async function destroyToken(url, storage, key) {
|
||||||
if (storage.getItem(key)) {
|
if (storage.getItem(key)) {
|
||||||
|
|
Loading…
Reference in New Issue