36 行
1.2 KiB
TypeScript
36 行
1.2 KiB
TypeScript
import type { QueryClient } from '@tanstack/react-query'
|
|
import type { IndexRouteObject, Location, NonIndexRouteObject, Params } from 'react-router-dom'
|
|
|
|
import type { LocaleCode } from '@/lib/locales'
|
|
|
|
export type PagePreparation = {
|
|
client: QueryClient
|
|
params: Readonly<Params>
|
|
locale: LocaleCode
|
|
searchParams: URLSearchParams }
|
|
|
|
export type LocaleSwitchRequest = {
|
|
location: Pick<Location, 'pathname' | 'search' | 'hash'>
|
|
params: Readonly<Params>
|
|
locale: LocaleCode
|
|
targetLocale: LocaleCode }
|
|
|
|
export type SitemapSource =
|
|
'static' | 'help' | 'posts' | 'tags' | 'deerjikists' | 'materials'
|
|
| 'descriptions' | 'tag_groups' | 'theatres'
|
|
|
|
export type PageRouteHandle = {
|
|
preload?: (locale: LocaleCode) => Promise<unknown>
|
|
prepare?: (request: PagePreparation) => Promise<number>
|
|
switchLocale?: (request: LocaleSwitchRequest) => Promise<string>
|
|
locale?: LocaleCode
|
|
robots?: 'noindex'
|
|
authentication?: 'user'
|
|
sitemap?: SitemapSource[]
|
|
redirectTo?: string
|
|
notFound?: boolean }
|
|
|
|
export type PageRoute = { handle?: PageRouteHandle } & (
|
|
Omit<IndexRouteObject, 'handle'>
|
|
| (Omit<NonIndexRouteObject, 'handle' | 'children'> & { children?: PageRoute[] }))
|