Stockage persistent des requêtes

This commit is contained in:
2024-12-11 00:30:20 +01:00
parent 1c52ff5a10
commit db7a0b970d
7 changed files with 153 additions and 20 deletions

View File

@ -17,3 +17,27 @@ export function setItem(key: string, value: string): void {
export async function setItemAsync(key: string, value: string): Promise<void> {
localStorage.setItem(key, value)
}
/**
import AsyncStorage from '@react-native-async-storage/async-storage'
export async function deleteItemAsync(key: string): Promise<void> {
return AsyncStorage.removeItem(key)
}
export function getItem(key: string): string | null {
return Promise.apply(AsyncStorage.getItem(key))
}
export async function getItemAsync(key: string): Promise<string | null> {
return AsyncStorage.getItem(key)
}
export function setItem(key: string, value: string): void {
AsyncStorage.setItem(key, value)
}
export async function setItemAsync(key: string, value: string): Promise<void> {
return AsyncStorage.setItem(key, value)
}
*/

View File

@ -15,9 +15,9 @@ export interface AuthPayload {
}
const initialState: AuthState = {
loggedIn: SecureStore.getItem('apiName') !== null && SecureStore.getItem('apiToken') !== null,
name: SecureStore.getItem('apiName'),
token: SecureStore.getItem('apiToken'),
loggedIn: false,
name: null,
token: null,
}
export const authSlice = createSlice({