- base.css: var(--danger-color) (undefined, no fallback -> inherited color) -> var(--danger) - attendanceHelpers: re-export formatDate from formatters instead of a byte-identical copy - dashboard.ts: remove dead duplicate require2FAOptions (canonical copy is in settings.ts) - settings.ts: remove unused @deprecated systemSettingsOptions alias - PlanWork: drop redundant per-page plan.css import (loaded globally in AdminApp) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { queryOptions } from "@tanstack/react-query";
|
|
import apiFetch from "../../utils/api";
|
|
import { jsonQuery } from "../apiAdapter";
|
|
|
|
export const dashboardOptions = () =>
|
|
queryOptions({
|
|
queryKey: ["dashboard"],
|
|
queryFn: () => jsonQuery<Record<string, unknown>>("/api/admin/dashboard"),
|
|
staleTime: 60_000,
|
|
});
|
|
|
|
// require2FAOptions lives in ./settings.ts (the single definition consumers
|
|
// import). The duplicate copy that used to be here was dead.
|
|
|
|
export interface Session {
|
|
id: number | string;
|
|
is_current: boolean;
|
|
device_info?: {
|
|
icon?: string;
|
|
browser?: string;
|
|
os?: string;
|
|
};
|
|
ip_address: string;
|
|
created_at: string;
|
|
}
|
|
|
|
export const sessionsOptions = () =>
|
|
queryOptions({
|
|
queryKey: ["sessions"],
|
|
queryFn: async (): Promise<Session[]> => {
|
|
const response = await apiFetch("/api/admin/sessions");
|
|
const data = await response.json();
|
|
if (data.success) {
|
|
return Array.isArray(data.data) ? data.data : data.data?.sessions || [];
|
|
}
|
|
throw new Error(data.error || "Nepodařilo se načíst relace");
|
|
},
|
|
});
|