From 87269a6615ebe7a6144ca87cc065d82ee5a31ada Mon Sep 17 00:00:00 2001 From: kenduNMT Date: Mon, 10 Nov 2025 16:59:33 +0700 Subject: [PATCH] login register --- app/(tabs)/_layout.tsx | 53 ++++++++++++++++++++++++++++++ app/(tabs)/account.tsx | 9 ++++++ app/(tabs)/home.tsx | 9 ++++++ app/(tabs)/index.tsx | 0 app/(tabs)/products.tsx | 9 ++++++ app/_layout.tsx | 27 ++++++++++++++++ app/index.tsx | 72 +++++++++++++++++++++++++++++++++++++++++ package-lock.json | 31 ++++++++++++++++++ package.json | 9 +++--- services/auth.ts | 34 +++++++++++++++++++ 10 files changed, 249 insertions(+), 4 deletions(-) create mode 100644 app/(tabs)/home.tsx delete mode 100644 app/(tabs)/index.tsx create mode 100644 app/index.tsx diff --git a/app/(tabs)/_layout.tsx b/app/(tabs)/_layout.tsx index e69de29..93f0b5b 100644 --- a/app/(tabs)/_layout.tsx +++ b/app/(tabs)/_layout.tsx @@ -0,0 +1,53 @@ +import { Tabs } from "expo-router"; +import { Ionicons } from "@expo/vector-icons"; +import { Button, Alert } from "react-native"; +import AsyncStorage from "@react-native-async-storage/async-storage"; +import { useRouter } from "expo-router"; + +export default function TabsLayout() { + const router = useRouter(); + + const handleLogout = async () => { + Alert.alert("Đăng xuất", "Bạn có chắc muốn đăng xuất?", [ + { + text: "Hủy", + style: "cancel", + }, + { + text: "Đăng xuất", + style: "destructive", + onPress: async () => { + await AsyncStorage.removeItem("authToken"); + router.replace("/"); // quay về màn hình đăng nhập + }, + }, + ]); + }; + + return ( + + , + }} + /> + , + }} + /> + , + headerRight: () =>