refactor(mobile): more look and feel work
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 1m17s
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 1m17s
This commit is contained in:
31
lstMobile/src/hooks/useScannerStore.ts
Normal file
31
lstMobile/src/hooks/useScannerStore.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
type LastScan = {
|
||||
action?: string;
|
||||
type?: "success" | "error" | string;
|
||||
prompt?: string;
|
||||
message?: 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 }),
|
||||
}));
|
||||
Reference in New Issue
Block a user