Rocky_Mountain_Vending/.pnpm-store/v10/files/96/e6b3a33d01b1d9225be2f3cb768afb0510449f713eccbef765470e242c04731ad62b20cdcefb8922ed0e3eb2ba283d032439f2ab4a0cc63fc4ea68d58fb501
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

69 lines
No EOL
2.1 KiB
Text

'use client';
import { jsx as _jsx } from "react/jsx-runtime";
import React, { useEffect } from 'react';
import { useRouter } from './navigation';
import { getRedirectTypeFromError, getURLFromRedirectError } from './redirect';
import { RedirectType, isRedirectError } from './redirect-error';
function HandleRedirect({ redirect, reset, redirectType }) {
const router = useRouter();
useEffect(()=>{
React.startTransition(()=>{
if (redirectType === RedirectType.push) {
router.push(redirect, {});
} else {
router.replace(redirect, {});
}
reset();
});
}, [
redirect,
redirectType,
reset,
router
]);
return null;
}
export class RedirectErrorBoundary extends React.Component {
constructor(props){
super(props);
this.state = {
redirect: null,
redirectType: null
};
}
static getDerivedStateFromError(error) {
if (isRedirectError(error)) {
const url = getURLFromRedirectError(error);
const redirectType = getRedirectTypeFromError(error);
return {
redirect: url,
redirectType
};
}
// Re-throw if error is not for redirect
throw error;
}
// Explicit type is needed to avoid the generated `.d.ts` having a wide return type that could be specific to the `@types/react` version.
render() {
const { redirect, redirectType } = this.state;
if (redirect !== null && redirectType !== null) {
return /*#__PURE__*/ _jsx(HandleRedirect, {
redirect: redirect,
redirectType: redirectType,
reset: ()=>this.setState({
redirect: null
})
});
}
return this.props.children;
}
}
export function RedirectBoundary({ children }) {
const router = useRouter();
return /*#__PURE__*/ _jsx(RedirectErrorBoundary, {
router: router,
children: children
});
}
//# sourceMappingURL=redirect-boundary.js.map