thêm giao diện quản lý thuyền

This commit is contained in:
Tran Anh Tuan
2025-12-10 19:49:54 +07:00
parent df4318fed4
commit 3e1c4dcbc5
24 changed files with 2091 additions and 135 deletions

View File

@@ -1,3 +1,4 @@
import { ROLE, UID } from "@/constants";
import AsyncStorage from "@react-native-async-storage/async-storage";
export async function setStorageItem(
@@ -28,3 +29,20 @@ export async function removeStorageItem(key: string): Promise<void> {
console.error("Error removing storage item:", error);
}
}
export async function clearUserStorage() {
try {
await AsyncStorage.removeItem(UID);
await AsyncStorage.removeItem(ROLE);
} catch (error) {
console.error("Error with clear user Storage: ", error);
}
}
export async function addUserStorage(userId: string, role: string) {
try {
setStorageItem(UID, userId);
setStorageItem(ROLE, role);
} catch (error) {
console.error("Error with set user Storage: ", error);
}
}