feat: create function to load user data from storage
This commit is contained in:
parent
58f0fa0b30
commit
2fe80ecaab
1 changed files with 6 additions and 0 deletions
|
|
@ -6,3 +6,9 @@ import { USER_STORAGE } from './storageConfig';
|
|||
export async function storageUserSave(user: UserDTO) {
|
||||
await AsyncStorage.setItem(USER_STORAGE, JSON.stringify(user));
|
||||
}
|
||||
|
||||
export async function storageUserGet() {
|
||||
const storage = await AsyncStorage.getItem(USER_STORAGE);
|
||||
const user: UserDTO = storage ? JSON.parse(storage) : {};
|
||||
return user;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue