refactor(scanner): finished login stuff for current routes
This commit is contained in:
@@ -3,9 +3,11 @@ import { format } from "date-fns-tz";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import { useAppStore } from "../hooks/useAppStore";
|
||||
import { useMobileAuthStore } from "../hooks/useMobileAuth";
|
||||
import { useScannerStore } from "../hooks/useScannerStore";
|
||||
import { scannerFeedback } from "../lib/feedbackScan";
|
||||
import { sendTcpMessage } from "../lib/tcpScan";
|
||||
import { versionCheck } from "../lib/versionValidation";
|
||||
import { type ZebraScanResult, zebraScanner } from "../lib/ZebraScanner";
|
||||
import { ScannedLabelBox } from "./ScannedLabels";
|
||||
import { GlobalFooter } from "./UpdateFooter";
|
||||
@@ -52,11 +54,16 @@ export default function ProdScanner() {
|
||||
parseInt(serverPort || "0", 10),
|
||||
)) as any;
|
||||
// send the logs to lst but allow it to time out if it dose not exist just bc.
|
||||
|
||||
const data = {
|
||||
...scanned.data,
|
||||
runningNumber: scan.data.startsWith("000")
|
||||
? parseInt(scan.data.slice(10, -1) || "000", 10).toString()
|
||||
: "0",
|
||||
};
|
||||
try {
|
||||
await axios.post(
|
||||
`http://${serverIp.trim()}:3000/lst/api/mobile/logs`,
|
||||
scanned,
|
||||
data,
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@@ -71,6 +78,13 @@ export default function ProdScanner() {
|
||||
led: true,
|
||||
});
|
||||
setBGColor("bg-green-500");
|
||||
|
||||
// version check
|
||||
versionCheck();
|
||||
|
||||
// auth update
|
||||
useMobileAuthStore.getState().updateLastScan();
|
||||
|
||||
setTimeout(() => {
|
||||
setBGColor(null);
|
||||
}, 1 * 1000);
|
||||
|
||||
Reference in New Issue
Block a user