Improve frontend auth handling

This commit is contained in:
2026-05-02 15:13:28 +02:00
parent f1fd72520a
commit 36a5911fe4
11 changed files with 126 additions and 47 deletions
+25
View File
@@ -0,0 +1,25 @@
const TOKEN_STORAGE_KEY = 'token';
export const getToken = (): string | null => {
try {
return localStorage.getItem(TOKEN_STORAGE_KEY);
} catch {
return null;
}
};
export const setToken = (token: string) => {
try {
localStorage.setItem(TOKEN_STORAGE_KEY, token);
} catch {
// ingore
}
};
export const removeToken = () => {
try {
localStorage.removeItem(TOKEN_STORAGE_KEY);
} catch {
// ingore
}
};