mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
35 lines
784 B
TypeScript
35 lines
784 B
TypeScript
const { window } = global;
|
|
|
|
const local = {
|
|
clear: (): void => {
|
|
const { localStorage } = window;
|
|
|
|
localStorage.clear();
|
|
},
|
|
getItem: (itemName: string): string | null => {
|
|
const { localStorage } = window;
|
|
|
|
return localStorage.getItem(`FLEET::${itemName}`);
|
|
},
|
|
setItem: (itemName: string, value: string): void => {
|
|
const { localStorage } = window;
|
|
|
|
return localStorage.setItem(`FLEET::${itemName}`, value);
|
|
},
|
|
removeItem: (itemName: string): void => {
|
|
const { localStorage } = window;
|
|
|
|
localStorage.removeItem(`FLEET::${itemName}`);
|
|
},
|
|
};
|
|
|
|
export const authToken = (): string | null => {
|
|
return local.getItem("auth_token");
|
|
};
|
|
|
|
export const clearToken = (): void => {
|
|
return local.removeItem("auth_token");
|
|
};
|
|
|
|
export default local;
|