From b74733438391bf0b3ef761941f21438998ffa52e Mon Sep 17 00:00:00 2001 From: Ephraim Atta-Duncan Date: Tue, 5 Sep 2023 13:53:18 +0000 Subject: [PATCH] feat: redirect signed document to completed page --- apps/web/src/app/(signing)/sign/[token]/page.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/(signing)/sign/[token]/page.tsx b/apps/web/src/app/(signing)/sign/[token]/page.tsx index f3d69b403..c07384c10 100644 --- a/apps/web/src/app/(signing)/sign/[token]/page.tsx +++ b/apps/web/src/app/(signing)/sign/[token]/page.tsx @@ -1,4 +1,4 @@ -import { notFound } from 'next/navigation'; +import { notFound, redirect } from 'next/navigation'; import { match } from 'ts-pattern'; @@ -45,7 +45,11 @@ export default async function SigningPage({ params: { token } }: SigningPageProp return notFound(); } - const { documentData } = document; + if (document?.status === 'COMPLETED') { + redirect(`/sign/${token}/complete`); + } + + const user = await getServerComponentSession(); const documentDataUrl = await getFile(documentData) .then((buffer) => Buffer.from(buffer).toString('base64'))