From 85e96f5ed13a81fd466c6bbff31c539244750838 Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Mon, 11 May 2026 07:59:17 -0500 Subject: [PATCH] fix(scanner): logut out corrections refs #17 --- lstMobile/src/components/LSTScanner.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lstMobile/src/components/LSTScanner.tsx b/lstMobile/src/components/LSTScanner.tsx index f9c40e4..5631a64 100644 --- a/lstMobile/src/components/LSTScanner.tsx +++ b/lstMobile/src/components/LSTScanner.tsx @@ -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([]); - const scannerIdFromStore = useAppStore((s) => s.scannerId); const serverIp = useAppStore((s) => s.serverIp); - const serverPort = useAppStore((s) => s.serverPort); const [bgColor, setBGColor] = useState(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() { {user && ( -