24 lines
728 B
JavaScript
24 lines
728 B
JavaScript
const TOKEN_MULTIMEDIA = 'tokenMultimedia';
|
|
const TOKEN = 'token';
|
|
|
|
function getToken() {
|
|
const localToken = localStorage.getItem(TOKEN);
|
|
const sessionToken = sessionStorage.getItem(TOKEN);
|
|
|
|
return localToken || sessionToken || '';
|
|
}
|
|
function getTokenMultimedia() {
|
|
const localTokenMultimedia = localStorage.getItem(TOKEN_MULTIMEDIA);
|
|
const sessionTokenMultimedia = sessionStorage.getItem(TOKEN_MULTIMEDIA);
|
|
|
|
return localTokenMultimedia || sessionTokenMultimedia || '';
|
|
}
|
|
function isLoggedIn() {
|
|
const localToken = localStorage.getItem(TOKEN);
|
|
const sessionToken = sessionStorage.getItem(TOKEN);
|
|
|
|
return !!(localToken || sessionToken);
|
|
}
|
|
|
|
export { getToken, getTokenMultimedia, isLoggedIn };
|