Includes: LoginPage (PIN pad), DashboardPage (30s polling table grid), OrderDetailPage (full actions), ProductsPage (CRUD + printer zone), WaitersPage (block/reset PIN/delete), TablesPage, ReportsPage (shift summary + order history + CSV export), SettingsPage (printers + test print + sysadmin lock/unlock). TailwindCSS, React Query, react-hot-toast. Docker Compose service on port 5174.
19 lines
357 B
JavaScript
19 lines
357 B
JavaScript
import { create } from 'zustand'
|
|
|
|
const useAuthStore = create((set) => ({
|
|
user: null,
|
|
token: localStorage.getItem('token') || null,
|
|
|
|
login(user, token) {
|
|
localStorage.setItem('token', token)
|
|
set({ user, token })
|
|
},
|
|
|
|
logout() {
|
|
localStorage.removeItem('token')
|
|
set({ user: null, token: null })
|
|
},
|
|
}))
|
|
|
|
export default useAuthStore
|