Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 50x 5x 2x 3x | import type { ListConfig } from '../../interfaces'
export type NavigatorFn = (path: string) => void
export interface DefaultAddNavConfig {
config: ListConfig
navigate: NavigatorFn
}
export function createDefaultAddNavHandler({ config, navigate }: DefaultAddNavConfig): () => void {
return () => {
if (!config.createTarget) {
throw new Error(
'createDefaultAddNavHandler called without config.createTarget. ' +
'ListConfig must declare createTarget explicitly; no pathname fallback is allowed.',
)
}
navigate(config.createTarget)
}
}
|