mirror of
https://github.com/warmbly/warmbly.git
synced 2026-08-25 00:00:58 +00:00
13c4ebb7a6
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.
18 lines
616 B
TypeScript
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,
|
|
});
|
|
}
|