refactor(scanner): finished login stuff for current routes

This commit is contained in:
2026-05-06 12:09:47 -05:00
parent a38e2e0339
commit 12412536d1
9 changed files with 91 additions and 46 deletions

View File

@@ -15,9 +15,11 @@ export default function TabsLayout() {
const isUnlocked = useMobileAuthStore((s) => s.isUnlocked);
const port = parseInt(serverPort || "0", 10) >= 50000;
if (!user || (!isUnlocked && !port)) {
return <Redirect href="/login" />;
console.log(port);
if (!port) {
if (!user || !isUnlocked) {
return <Redirect href="/login" />;
}
}
const isNormalScanner = parseInt(serverPort || "0", 10) >= 50000;

View File

@@ -2,7 +2,7 @@ import axios from "axios";
import { useRouter } from "expo-router";
import { useState } from "react";
import { Button, Text, View } from "react-native";
import { Alert, Button, Text, View } from "react-native";
import { Input } from "../components/ui/input";
import { useAppStore } from "../hooks/useAppStore";
import { useMobileAuthStore } from "../hooks/useMobileAuth";
@@ -38,6 +38,7 @@ export default function Login() {
}
} catch (error) {
console.log(error);
Alert.alert("Login Error", `Invalid pin please try again`);
}
};
@@ -70,7 +71,7 @@ export default function Login() {
</View>
</View>
<View>
<Text>
<Text className="p-3">
Warning: If you are logged into another scanner you will encounter
scan errors, please do not try to log into more than 1 scanner at a
time.

View File

@@ -25,6 +25,8 @@ export default function Setup() {
const server = useServerStore((s) => s.serverVersion);
// TODO: if on lst version and the user is manager or admin just login
const authCheck = () => {
if (pin === "6971") {
setAuth(true);