mirror of
https://github.com/documenso/documenso.git
synced 2025-11-20 19:51:32 +10:00
fix: add embed
This commit is contained in:
26
apps/remix/app/routes/embed+/_layout.tsx
Normal file
26
apps/remix/app/routes/embed+/_layout.tsx
Normal file
@ -0,0 +1,26 @@
|
||||
import { Outlet, isRouteErrorResponse, useRouteError } from 'react-router';
|
||||
|
||||
import { EmbedAuthenticationRequired } from '~/components/embed/embed-authentication-required';
|
||||
import { EmbedPaywall } from '~/components/embed/embed-paywall';
|
||||
|
||||
export default function Layout() {
|
||||
return <Outlet />;
|
||||
}
|
||||
|
||||
export function ErrorBoundary() {
|
||||
const error = useRouteError();
|
||||
|
||||
if (isRouteErrorResponse(error)) {
|
||||
if (error.status === 401 && error.data.type === 'embed-authentication-required') {
|
||||
return (
|
||||
<EmbedAuthenticationRequired email={error.data.email} returnTo={error.data.returnTo} />
|
||||
);
|
||||
}
|
||||
|
||||
if (error.status === 403 && error.data.type === 'embed-paywall') {
|
||||
return <EmbedPaywall />;
|
||||
}
|
||||
}
|
||||
|
||||
return <div>Not Found</div>;
|
||||
}
|
||||
Reference in New Issue
Block a user