Files
personal-finance/frontend-web/src/lib/api/token.ts
Alexander Zinn 2cff25c55b Update formatting and improve consistency across configuration and documentation files
- Adjusted formatting in .prettierrc for consistent newline handling.
- Enhanced API documentation in BACKEND_PROMPT.md for better readability and structure.
- Updated docker-compose.yml to standardize quotes and improve health check commands.
- Refactored ESLint configuration for better readability and consistency.
- Made minor formatting adjustments in various frontend components for improved user experience and code clarity.
2025-12-11 02:24:01 -05:00

38 lines
661 B
TypeScript

/**
* Token Storage Utilities
*/
const TOKEN_KEY = 'auth_token';
const USER_KEY = 'auth_user';
export const tokenStorage = {
getToken(): string | null {
return localStorage.getItem(TOKEN_KEY);
},
setToken(token: string): void {
localStorage.setItem(TOKEN_KEY, token);
},
removeToken(): void {
localStorage.removeItem(TOKEN_KEY);
},
getUser(): string | null {
return localStorage.getItem(USER_KEY);
},
setUser(user: string): void {
localStorage.setItem(USER_KEY, user);
},
removeUser(): void {
localStorage.removeItem(USER_KEY);
},
clear(): void {
this.removeToken();
this.removeUser();
}
};