UNPKG

@tanstack/vue-router

Version:

Modern and scalable routing for Vue applications

35 lines (34 loc) 1.09 kB
import { CatchBoundary } from "./CatchBoundary.js"; import { useRouterState } from "./useRouterState.js"; import { isNotFound } from "@tanstack/router-core"; import * as Vue from "vue"; //#region src/not-found.tsx function CatchNotFound(props) { const resetKey = useRouterState({ select: (s) => `not-found-${s.location.pathname}-${s.status}` }); const errorComponentFn = (componentProps) => { const error = componentProps.error; if (isNotFound(error)) { if (props.fallback) return props.fallback(error); return Vue.h("p", null, "Not Found"); } else throw error; }; return Vue.h(CatchBoundary, { getResetKey: () => resetKey.value, onCatch: (error) => { if (isNotFound(error)) { if (props.onCatch) props.onCatch(error); } else throw error; }, errorComponent: errorComponentFn, children: props.children }); } var DefaultGlobalNotFound = Vue.defineComponent({ name: "DefaultGlobalNotFound", setup() { return () => Vue.h("p", null, "Not Found"); } }); //#endregion export { CatchNotFound, DefaultGlobalNotFound }; //# sourceMappingURL=not-found.js.map