Khởi tạo ban đầu

This commit is contained in:
Tran Anh Tuan
2025-11-28 16:59:57 +07:00
parent 2911be97b2
commit 4ba46a7df2
131 changed files with 28066 additions and 0 deletions

30
utils/storage.ts Normal file
View File

@@ -0,0 +1,30 @@
import AsyncStorage from "@react-native-async-storage/async-storage";
export async function setStorageItem(
key: string,
value: string
): Promise<void> {
try {
await AsyncStorage.setItem(key, value);
} catch (error) {
console.error("Error setting storage item:", error);
}
}
export async function getStorageItem(key: string): Promise<string | null> {
try {
const value = await AsyncStorage.getItem(key);
return value;
} catch (error) {
console.error("Error getting storage item:", error);
return null;
}
}
export async function removeStorageItem(key: string): Promise<void> {
try {
await AsyncStorage.removeItem(key);
} catch (error) {
console.error("Error removing storage item:", error);
}
}