feat: create function to save user on storage

This commit is contained in:
Vinicius Souza 2024-10-31 09:26:04 -03:00
parent e08b2991b7
commit 591d5734bc
2 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1,3 @@
const USER_STORAGE = '@ignitegym:user';
export { USER_STORAGE };

View 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));
}