2022-05-26 22:52:04 +02:00
|
|
|
export const LOCAL_STORAGE_KEYS = {
|
|
|
|
username: 'username',
|
2022-05-30 06:52:38 +02:00
|
|
|
hasDisplayedNotificationModal: 'HAS_DISPLAYED_NOTIFICATION_MODAL',
|
2022-06-27 08:01:52 +02:00
|
|
|
userVisitCount: 'USER_VISIT_COUNT',
|
2022-05-26 22:52:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export function getLocalStorage(key) {
|
|
|
|
try {
|
|
|
|
return localStorage.getItem(key);
|
2023-05-21 06:15:25 +02:00
|
|
|
} catch (e) {
|
|
|
|
console.error(e);
|
|
|
|
}
|
2022-05-26 22:52:04 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function setLocalStorage(key, value) {
|
|
|
|
try {
|
|
|
|
if (value !== '' && value !== null) {
|
|
|
|
localStorage.setItem(key, value);
|
|
|
|
} else {
|
|
|
|
localStorage.removeItem(key);
|
|
|
|
}
|
|
|
|
return true;
|
2023-05-21 06:15:25 +02:00
|
|
|
} catch (e) {
|
|
|
|
console.error(e);
|
2022-05-26 22:52:04 +02:00
|
|
|
}
|
2023-05-21 06:15:25 +02:00
|
|
|
return false;
|
2022-05-26 22:52:04 +02:00
|
|
|
}
|