feat: create function to save user on storage
This commit is contained in:
parent
e08b2991b7
commit
591d5734bc
2 changed files with 11 additions and 0 deletions
3
src/storage/storageConfig.ts
Normal file
3
src/storage/storageConfig.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
const USER_STORAGE = '@ignitegym:user';
|
||||||
|
|
||||||
|
export { USER_STORAGE };
|
||||||
8
src/storage/storageUser.ts
Normal file
8
src/storage/storageUser.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||||
|
|
||||||
|
import { UserDTO } from '@dtos/UserDTO';
|
||||||
|
import { USER_STORAGE } from './storageConfig';
|
||||||
|
|
||||||
|
export async function storageUserSave(user: UserDTO) {
|
||||||
|
await AsyncStorage.setItem(USER_STORAGE, JSON.stringify(user));
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue