このコミットが含まれているのは:
@@ -1,13 +1,19 @@
|
||||
import { matchPath } from 'react-router-dom'
|
||||
|
||||
import { unlocalisedPath } from '@/lib/locales'
|
||||
import type { QueryClient } from '@tanstack/react-query'
|
||||
import type { IndexRouteObject, NonIndexRouteObject, Params } from 'react-router-dom'
|
||||
|
||||
import type { LocaleCode } from '@/lib/locales'
|
||||
|
||||
const PAGE_LOCALES: { path: string; locale: LocaleCode }[] = [
|
||||
{ path: '/gekanator', locale: 'ja' }]
|
||||
export type PagePreparation = {
|
||||
client: QueryClient
|
||||
params: Readonly<Params>
|
||||
locale: LocaleCode
|
||||
searchParams: URLSearchParams }
|
||||
|
||||
export type PageRouteHandle = {
|
||||
ssr?: (request: PagePreparation) => Promise<number>
|
||||
locale?: LocaleCode
|
||||
notFound?: boolean }
|
||||
|
||||
export const requiredPageLocale = (pathname: string): LocaleCode | null =>
|
||||
PAGE_LOCALES.find (page =>
|
||||
matchPath ({ path: page.path, end: true }, unlocalisedPath (pathname)))?.locale ?? null
|
||||
export type PageRoute = { handle?: PageRouteHandle } & (
|
||||
Omit<IndexRouteObject, 'handle'>
|
||||
| (Omit<NonIndexRouteObject, 'handle' | 'children'> & { children?: PageRoute[] }))
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする