feat(driver-pwa): auth store + ky client + typed driver API (zod)
Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
|
||||
interface AuthState {
|
||||
token: string | null;
|
||||
driverId: number | null;
|
||||
setSession: (token: string, driverId: number) => void;
|
||||
clear: () => void;
|
||||
}
|
||||
|
||||
export const useAuth = create<AuthState>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
token: null,
|
||||
driverId: null,
|
||||
setSession: (token, driverId) => set({ token, driverId }),
|
||||
clear: () => set({ token: null, driverId: null }),
|
||||
}),
|
||||
{ name: "pp-driver-auth" }
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user