Files
warmbly/admin/src/hooks/useMe.ts
T
Matthew Meszaros 13c4ebb7a6 rename web-admin -> admin
Shorter, cleaner path. The 'web-' prefix was redundant given the dir
sits at the repo root next to web/ and is unambiguously the admin web
app. Git tracked the rename so blame + history follow through to the
new location.

Updated README.md and docs/VENDOR_LOCKIN.md references plus the package
README header. No code changes.
2026-05-27 16:17:47 +00:00

18 lines
616 B
TypeScript

import { useQuery } from "@tanstack/react-query";
import { getMe } from "@/lib/api/client/auth";
// Single source of truth for "who is the logged-in admin?". Used by
// route guards, the header user menu, and any page that wants to gate
// content on `is_admin` / specific permissions.
export function useMe() {
return useQuery({
queryKey: ["me"],
queryFn: getMe,
// The dashboard refetches on focus; the admin app is touched
// less frequently and doesn't need that aggressiveness.
refetchOnWindowFocus: false,
retry: false,
staleTime: 60_000,
});
}