Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
23 lines
781 B
TypeScript
23 lines
781 B
TypeScript
'use client'
|
|
|
|
import { useQuery } from '@tanstack/react-query'
|
|
|
|
import { consumerKeys } from '@/queries/consumerKeys'
|
|
import { unwrapService } from '@/queries/unwrapService'
|
|
import { LIST_PUBLIC_CATEGORIES } from '@/services/eventCategories'
|
|
|
|
/**
|
|
* Public category taxonomy is admin-managed and changes rarely.
|
|
* Keep one shared staleTime here so every consumer of
|
|
* `consumerKeys.publicCategories()` agrees (wizard, step 1, browse).
|
|
*/
|
|
export const PUBLIC_CATEGORIES_STALE_TIME_MS = 5 * 60_000
|
|
|
|
export const usePublicCategoriesQuery = (enabled = true) =>
|
|
useQuery({
|
|
queryKey: consumerKeys.publicCategories(),
|
|
enabled,
|
|
queryFn: async () => unwrapService(await LIST_PUBLIC_CATEGORIES({ errorMode: 'parent' })),
|
|
staleTime: PUBLIC_CATEGORIES_STALE_TIME_MS,
|
|
})
|