fix(scanner): logut out corrections
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 1m24s

refs #17
This commit is contained in:
2026-05-11 07:59:17 -05:00
parent 6b515c608f
commit 85e96f5ed1

View File

@@ -1,6 +1,6 @@
import axios from "axios";
import { format } from "date-fns-tz";
import { useFocusEffect } from "expo-router";
import { Redirect, useFocusEffect, useRouter } from "expo-router";
import { useCallback, useEffect, useState } from "react";
import { Alert, Button, Text, View } from "react-native";
import { useAppStore } from "../hooks/useAppStore";
@@ -23,14 +23,13 @@ const formatName = (name?: string) =>
export default function LSTScanner() {
const user = useMobileAuthStore((s) => s.user);
const logout = useMobileAuthStore((s) => s.logout);
const router = useRouter();
// TODO : move to off tcp stuff after od
const lastScan = useScannerStore((s) => s.lastScan);
const setLastScan = useScannerStore((s) => s.setLastScan);
const [tagScans, setTagScans] = useState<any>([]);
const scannerIdFromStore = useAppStore((s) => s.scannerId);
const serverIp = useAppStore((s) => s.serverIp);
const serverPort = useAppStore((s) => s.serverPort);
const [bgColor, setBGColor] = useState<string | null>(null);
const handleScan = useCallback(
@@ -154,6 +153,13 @@ export default function LSTScanner() {
setTagScans([]);
};
const logoutScanner = () => {
setTagScans([]);
setLastScan(null);
logout();
router.replace("/");
};
//console.log(lastScan);
useFocusEffect(
@@ -228,7 +234,7 @@ export default function LSTScanner() {
<View className="m-2">
{user && (
<View className="items-center">
<Button title="Logout" onPress={logout} />
<Button title="Logout" onPress={logoutScanner} />
</View>
)}
</View>