mirror of
https://github.com/documenso/documenso.git
synced 2025-11-19 11:12:06 +10:00
fix: errors
This commit is contained in:
@ -47,6 +47,7 @@ export const TemplateCreateDialog = ({ templateRootPath }: TemplateCreateDialogP
|
||||
setIsUploadingFile(true);
|
||||
|
||||
try {
|
||||
// Todo
|
||||
// const { type, data } = await putPdfFile(file);
|
||||
|
||||
const formData = new FormData();
|
||||
@ -56,7 +57,7 @@ export const TemplateCreateDialog = ({ templateRootPath }: TemplateCreateDialogP
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then(async (res) => await res.json())
|
||||
.catch((e) => {
|
||||
console.error('Upload failed:', e);
|
||||
throw new AppError('UPLOAD_FAILED');
|
||||
|
||||
@ -426,7 +426,7 @@ export const TemplateDirectLinkDialog = ({
|
||||
await toggleTemplateDirectLink({
|
||||
templateId: template.id,
|
||||
enabled: isEnabled,
|
||||
}).catch((e) => null);
|
||||
}).catch(() => null);
|
||||
|
||||
onOpenChange(false);
|
||||
}}
|
||||
|
||||
@ -159,7 +159,7 @@ export function TemplateUseDialog({
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then(async (res) => await res.json())
|
||||
.catch((e) => {
|
||||
console.error('Upload failed:', e);
|
||||
throw new AppError('UPLOAD_FAILED');
|
||||
|
||||
@ -5,7 +5,7 @@ import { useForm } from 'react-hook-form';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { trpc } from '@documenso/trpc/react';
|
||||
import { authClient } from '@documenso/auth/client';
|
||||
import { cn } from '@documenso/ui/lib/utils';
|
||||
import { Button } from '@documenso/ui/primitives/button';
|
||||
import {
|
||||
@ -44,10 +44,10 @@ export const ForgotPasswordForm = ({ className }: ForgotPasswordFormProps) => {
|
||||
|
||||
const isSubmitting = form.formState.isSubmitting;
|
||||
|
||||
const { mutateAsync: forgotPassword } = trpc.profile.forgotPassword.useMutation();
|
||||
|
||||
const onFormSubmit = async ({ email }: TForgotPasswordFormSchema) => {
|
||||
await forgotPassword({ email }).catch(() => null);
|
||||
await authClient.emailPassword.forgotPassword({ email }).catch(() => null);
|
||||
|
||||
await navigate('/check-email');
|
||||
|
||||
toast({
|
||||
title: _(msg`Reset email sent`),
|
||||
@ -58,8 +58,6 @@ export const ForgotPasswordForm = ({ className }: ForgotPasswordFormProps) => {
|
||||
});
|
||||
|
||||
form.reset();
|
||||
|
||||
navigate('/check-email');
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@ -270,6 +270,8 @@ export const SignInForm = ({
|
||||
|
||||
const onSignInWithOIDCClick = async () => {
|
||||
try {
|
||||
// eslint-disable-next-line no-promise-executor-return
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
// await signIn('oidc', {
|
||||
// callbackUrl,
|
||||
// });
|
||||
|
||||
@ -185,6 +185,7 @@ export const SignUpForm = ({
|
||||
|
||||
const onSignUpWithOIDCClick = async () => {
|
||||
try {
|
||||
// eslint-disable-next-line no-promise-executor-return
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
// await signIn('oidc', { callbackUrl: SIGN_UP_REDIRECT_PATH });
|
||||
} catch (err) {
|
||||
|
||||
@ -121,7 +121,7 @@ export function TeamBrandingPreferencesForm({ team, settings }: TeamBrandingPref
|
||||
void fetch(`/api/file?key=${file.key}`, {
|
||||
method: 'GET',
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then(async (res) => await res.json())
|
||||
.then((data) => {
|
||||
const objectUrl = URL.createObjectURL(new Blob([data.binaryData]));
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ export const DocumentSigningAuthAccount = ({
|
||||
// // Todo: Redirect to signin like below
|
||||
// }
|
||||
|
||||
navigate(`/signin#email=${email}`);
|
||||
await navigate(`/signin#email=${email}`);
|
||||
} catch {
|
||||
setIsSigningOut(false);
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ export const DocumentSigningAuthPageView = ({
|
||||
// Todo: Redirect false
|
||||
await authClient.signOut();
|
||||
|
||||
navigate(emailHasAccount ? `/signin#email=${email}` : `/signup#email=${email}`);
|
||||
await navigate(emailHasAccount ? `/signin#email=${email}` : `/signup#email=${email}`);
|
||||
} catch {
|
||||
toast({
|
||||
title: _(msg`Something went wrong`),
|
||||
|
||||
@ -107,7 +107,7 @@ export const DocumentSigningForm = ({
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
|
||||
redirectUrl ? navigate(redirectUrl) : navigate(`/sign/${recipient.token}/complete`);
|
||||
await navigate(redirectUrl ? redirectUrl : `/sign/${recipient.token}/complete`);
|
||||
};
|
||||
|
||||
return (
|
||||
@ -157,7 +157,7 @@ export const DocumentSigningForm = ({
|
||||
variant="secondary"
|
||||
size="lg"
|
||||
disabled={typeof window !== 'undefined' && window.history.length <= 1}
|
||||
onClick={() => navigate(-1)}
|
||||
onClick={async () => navigate(-1)}
|
||||
>
|
||||
<Trans>Cancel</Trans>
|
||||
</Button>
|
||||
@ -239,7 +239,7 @@ export const DocumentSigningForm = ({
|
||||
variant="secondary"
|
||||
size="lg"
|
||||
disabled={typeof window !== 'undefined' && window.history.length <= 1}
|
||||
onClick={() => navigate(-1)}
|
||||
onClick={async () => navigate(-1)}
|
||||
>
|
||||
<Trans>Cancel</Trans>
|
||||
</Button>
|
||||
|
||||
41
apps/remix/app/routes/_redirects+/ingest.$.tsx
Normal file
41
apps/remix/app/routes/_redirects+/ingest.$.tsx
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* https://posthog.com/docs/advanced/proxy/remix
|
||||
*/
|
||||
import type { Route } from './+types/ingest.$';
|
||||
|
||||
const API_HOST = 'eu.i.posthog.com';
|
||||
const ASSET_HOST = 'eu-assets.i.posthog.com';
|
||||
|
||||
const posthogProxy = async (request: Request) => {
|
||||
const url = new URL(request.url);
|
||||
const hostname = url.pathname.startsWith('/ingest/static/') ? ASSET_HOST : API_HOST;
|
||||
|
||||
const newUrl = new URL(url);
|
||||
newUrl.protocol = 'https';
|
||||
newUrl.hostname = hostname;
|
||||
newUrl.port = '443';
|
||||
newUrl.pathname = newUrl.pathname.replace(/^\/ingest/, '');
|
||||
|
||||
const headers = new Headers(request.headers);
|
||||
headers.set('host', hostname);
|
||||
|
||||
const response = await fetch(newUrl, {
|
||||
method: request.method,
|
||||
headers,
|
||||
body: request.body,
|
||||
});
|
||||
|
||||
return new Response(response.body, {
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
headers: response.headers,
|
||||
});
|
||||
};
|
||||
|
||||
export async function loader({ request }: Route.LoaderArgs) {
|
||||
return posthogProxy(request);
|
||||
}
|
||||
|
||||
export async function action({ request }: Route.ActionArgs) {
|
||||
return posthogProxy(request);
|
||||
}
|
||||
@ -35,5 +35,5 @@ export const loader = ({ request }: Route.LoaderArgs) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
return redirect(NEXT_PUBLIC_MARKETING_URL());
|
||||
throw redirect(NEXT_PUBLIC_MARKETING_URL());
|
||||
};
|
||||
|
||||
@ -2,6 +2,7 @@ import { createCookieSessionStorage } from 'react-router';
|
||||
import { createThemeSessionResolver } from 'remix-themes';
|
||||
|
||||
import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';
|
||||
import { env } from '@documenso/lib/utils/env';
|
||||
|
||||
const themeSessionStorage = createCookieSessionStorage({
|
||||
cookie: {
|
||||
@ -12,7 +13,7 @@ const themeSessionStorage = createCookieSessionStorage({
|
||||
secrets: ['insecure-secret'], // Todo: Don't need secret
|
||||
// Todo: Check this works on production.
|
||||
// Set domain and secure only if in production
|
||||
...(import.meta.env.PROD ? { domain: NEXT_PUBLIC_WEBAPP_URL(), secure: true } : {}),
|
||||
...(env('NODE_ENV') === 'production' ? { domain: NEXT_PUBLIC_WEBAPP_URL(), secure: true } : {}),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ declare module 'react-router' {
|
||||
interface AppLoadContext extends Awaited<ReturnType<typeof getLoadContext>> {}
|
||||
}
|
||||
|
||||
const logger = new AppLogger('[Context]');
|
||||
const logger = new AppLogger('Context');
|
||||
|
||||
export async function getLoadContext(args: GetLoadContextArgs) {
|
||||
const initTime = Date.now();
|
||||
|
||||
Reference in New Issue
Block a user