Files
cnapp/src/auth/tokenStorage.ts
T
2026-07-31 03:16:32 +02:00

16 lines
432 B
TypeScript

import AsyncStorage from '@react-native-async-storage/async-storage';
const TOKEN_KEY = 'cnapp.authToken';
export async function getStoredToken(): Promise<string | null> {
return AsyncStorage.getItem(TOKEN_KEY);
}
export async function setStoredToken(token: string | null): Promise<void> {
if (token === null) {
await AsyncStorage.removeItem(TOKEN_KEY);
} else {
await AsyncStorage.setItem(TOKEN_KEY, token);
}
}