Rocky_Mountain_Vending/.pnpm-store/v10/files/68/b3307fd3589405b3e1f2046a062260337a6479c4c3682201250ada041805164b2d4d74b4bc75c5883fb7fea8d72cb19c8de1d3ca8a2f1e2d0a6c86da0a27e0
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

68 lines
No EOL
3.5 KiB
Text

import { RedirectStatusCode } from './redirect-status-code';
import { RedirectType, isRedirectError, REDIRECT_ERROR_CODE } from './redirect-error';
const actionAsyncStorage = typeof window === 'undefined' ? require('../../server/app-render/action-async-storage.external').actionAsyncStorage : undefined;
export function getRedirectError(url, type, statusCode = RedirectStatusCode.TemporaryRedirect) {
const error = Object.defineProperty(new Error(REDIRECT_ERROR_CODE), "__NEXT_ERROR_CODE", {
value: "E394",
enumerable: false,
configurable: true
});
error.digest = `${REDIRECT_ERROR_CODE};${type};${url};${statusCode};`;
return error;
}
/**
* This function allows you to redirect the user to another URL. It can be used in
* [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),
* [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and
* [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).
*
* - In a Server Component, this will insert a meta tag to redirect the user to the target page.
* - In a Route Handler or Server Action, it will serve a 307/303 to the caller.
* - In a Server Action, type defaults to 'push' and 'replace' elsewhere.
*
* Read more: [Next.js Docs: `redirect`](https://nextjs.org/docs/app/api-reference/functions/redirect)
*/ export function redirect(/** The URL to redirect to */ url, type) {
type ??= actionAsyncStorage?.getStore()?.isAction ? RedirectType.push : RedirectType.replace;
throw getRedirectError(url, type, RedirectStatusCode.TemporaryRedirect);
}
/**
* This function allows you to redirect the user to another URL. It can be used in
* [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),
* [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and
* [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).
*
* - In a Server Component, this will insert a meta tag to redirect the user to the target page.
* - In a Route Handler or Server Action, it will serve a 308/303 to the caller.
*
* Read more: [Next.js Docs: `redirect`](https://nextjs.org/docs/app/api-reference/functions/redirect)
*/ export function permanentRedirect(/** The URL to redirect to */ url, type = RedirectType.replace) {
throw getRedirectError(url, type, RedirectStatusCode.PermanentRedirect);
}
export function getURLFromRedirectError(error) {
if (!isRedirectError(error)) return null;
// Slices off the beginning of the digest that contains the code and the
// separating ';'.
return error.digest.split(';').slice(2, -2).join(';');
}
export function getRedirectTypeFromError(error) {
if (!isRedirectError(error)) {
throw Object.defineProperty(new Error('Not a redirect error'), "__NEXT_ERROR_CODE", {
value: "E260",
enumerable: false,
configurable: true
});
}
return error.digest.split(';', 2)[1];
}
export function getRedirectStatusCodeFromError(error) {
if (!isRedirectError(error)) {
throw Object.defineProperty(new Error('Not a redirect error'), "__NEXT_ERROR_CODE", {
value: "E260",
enumerable: false,
configurable: true
});
}
return Number(error.digest.split(';').at(-2));
}
//# sourceMappingURL=redirect.js.map