26 lines
915 B
Plaintext
26 lines
915 B
Plaintext
//#region src/not-found.ts
|
|
/**
|
|
* Create a not-found error object recognized by TanStack Router.
|
|
*
|
|
* Throw this from loaders/actions to trigger the nearest `notFoundComponent`.
|
|
* Use `routeId` to target a specific route's not-found boundary. If `throw`
|
|
* is true, the error is thrown instead of returned.
|
|
*
|
|
* @param options Optional settings including `routeId`, `headers`, and `throw`.
|
|
* @returns A not-found error object that can be thrown or returned.
|
|
* @link https://tanstack.com/router/latest/docs/router/framework/react/api/router/notFoundFunction
|
|
*/
|
|
function notFound(options = {}) {
|
|
options.isNotFound = true;
|
|
if (options.throw) throw options;
|
|
return options;
|
|
}
|
|
/** Determine if a value is a TanStack Router not-found error. */
|
|
function isNotFound(obj) {
|
|
return obj?.isNotFound === true;
|
|
}
|
|
//#endregion
|
|
exports.isNotFound = isNotFound;
|
|
exports.notFound = notFound;
|
|
|
|
//# sourceMappingURL=not-found.cjs.map |