20 lines
533 B
TypeScript
20 lines
533 B
TypeScript
import * as SecureStore from 'expo-secure-store';
|
|
|
|
export const saveUserData = async (userData: any) => {
|
|
try {
|
|
await SecureStore.setItemAsync('userData', JSON.stringify(userData));
|
|
} catch (error) {
|
|
console.error('Error saving user data:', error);
|
|
}
|
|
};
|
|
|
|
export const getUserData = async () => {
|
|
try {
|
|
const userData = await SecureStore.getItemAsync('userData');
|
|
return userData ? JSON.parse(userData) : null;
|
|
} catch (error) {
|
|
console.error('Error getting user data:', error);
|
|
return null;
|
|
}
|
|
};
|