20 lines
395 B
TypeScript
20 lines
395 B
TypeScript
import { create } from 'zustand';
|
|
|
|
type ApiLog = {
|
|
method: string;
|
|
url: string;
|
|
status: number;
|
|
responseTime: number;
|
|
timestamp: string;
|
|
};
|
|
|
|
type ApiLogStore = {
|
|
apiLogs: ApiLog[];
|
|
logApiCall: (log: ApiLog) => void;
|
|
};
|
|
|
|
export const useApiLogStore = create<ApiLogStore>((set) => ({
|
|
apiLogs: [],
|
|
logApiCall: (log) => set((state) => ({ apiLogs: [...state.apiLogs, log] })),
|
|
}));
|