thêm giao diện quản lý thuyền
This commit is contained in:
@@ -3,8 +3,10 @@ import { Tabs, useSegments } from "expo-router";
|
||||
import { HapticTab } from "@/components/haptic-tab";
|
||||
import { IconSymbol } from "@/components/ui/icon-symbol";
|
||||
import { Colors } from "@/constants/theme";
|
||||
import { queryProfile } from "@/controller/AuthController";
|
||||
import { useI18n } from "@/hooks/use-i18n";
|
||||
import { useColorScheme } from "@/hooks/use-theme-context";
|
||||
import { addUserStorage } from "@/utils/storage";
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
export default function TabLayout() {
|
||||
@@ -29,6 +31,23 @@ export default function TabLayout() {
|
||||
}
|
||||
}, [currentSegment]);
|
||||
|
||||
useEffect(() => {
|
||||
const getUserProfile = async () => {
|
||||
try {
|
||||
const resp = await queryProfile();
|
||||
if (resp.data && resp.status === 200) {
|
||||
await addUserStorage(
|
||||
resp.data.id || "",
|
||||
resp.data.metadata?.user_type || ""
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error when get Profile: ", error);
|
||||
}
|
||||
};
|
||||
getUserProfile();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Tabs
|
||||
screenOptions={{
|
||||
|
||||
Reference in New Issue
Block a user