Files
lst_v3/lstMobile/src/hooks/useScannerStore.ts
Blake Matthes 30ffd843c7
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 1m24s
feat(mobile): update notifications and more error handling added
2026-04-30 17:02:21 -05:00

34 lines
620 B
TypeScript

import { create } from "zustand";
type LastScan = {
terminalId?: string;
screen?: string;
prompt?: string;
message?: string;
status: "success" | "error" | "location" | "unknown";
lines?: string[];
timestamp?: number;
};
type ScannerStore = {
lastScan: LastScan | null;
setLastScan: (scan: LastScan | null) => void;
clearLastScan: () => void;
};
export const useScannerStore = create<ScannerStore>((set) => ({
lastScan: null,
setLastScan: (scan) =>
set({
lastScan: scan
? {
...scan,
timestamp: Date.now(),
}
: null,
}),
clearLastScan: () => set({ lastScan: null }),
}));