diff --git a/README.md b/README.md
index 825b6ce53..df0c6a76e 100644
--- a/README.md
+++ b/README.md
@@ -17,5 +17,3 @@ Documenso aims to be the world's most trusted document signing tool. This trust
- Set DATABASE_URL and SENDGRID_API_KEY values in .env file
- Run npm run dev root directory to start
- Register a new user at http://localhost:3000/signup
-
-test
diff --git a/apps/web/components/editor/field.tsx b/apps/web/components/editor/field.tsx
index 7d38d8983..60204bcd9 100644
--- a/apps/web/components/editor/field.tsx
+++ b/apps/web/components/editor/field.tsx
@@ -22,8 +22,6 @@ export default function Field(props: FieldPropsType) {
props.field.position || { x: 0, y: -842 }
);
const nodeRef = React.createRef();
- console.log(props.field);
-
const onControlledDrag = (e: any, position: any) => {
const { x, y } = position;
setPosition({ x, y });
diff --git a/apps/web/components/editor/pdf-editor.tsx b/apps/web/components/editor/pdf-editor.tsx
new file mode 100644
index 000000000..14f350f45
--- /dev/null
+++ b/apps/web/components/editor/pdf-editor.tsx
@@ -0,0 +1,19 @@
+import { NEXT_PUBLIC_WEBAPP_URL } from "@documenso/lib/constants";
+import { useRouter } from "next/router";
+import dynamic from "next/dynamic";
+import React from "react";
+
+const PDFViewer = dynamic(() => import("./pdf-viewer"), {
+ ssr: false,
+});
+
+export default function PDFEditor(props: any) {
+ const router = useRouter();
+
+ return (
+
+ );
+}
diff --git a/apps/web/components/pdf-viewer.jsx b/apps/web/components/editor/pdf-viewer.jsx
similarity index 99%
rename from apps/web/components/pdf-viewer.jsx
rename to apps/web/components/editor/pdf-viewer.jsx
index fdea6ee69..eaea14027 100644
--- a/apps/web/components/pdf-viewer.jsx
+++ b/apps/web/components/editor/pdf-viewer.jsx
@@ -1,6 +1,6 @@
import { Fragment, useState } from "react";
import { Document, Page } from "react-pdf/dist/esm/entry.webpack5";
-import Field from "./editor/field";
+import Field from "./field";
import short from "short-uuid";
import { Button } from "@documenso/ui";
const stc = require("string-to-color");
diff --git a/apps/web/pages/500.jsx b/apps/web/pages/500.jsx
new file mode 100644
index 000000000..b344d947d
--- /dev/null
+++ b/apps/web/pages/500.jsx
@@ -0,0 +1,10 @@
+import Link from "next/link";
+
+export default function FiveUhOh() {
+ return (
+ <>
+ 500 - Something went wrong.
+ Go back home
+ >
+ );
+}
diff --git a/apps/web/pages/documents/[id]/index.tsx b/apps/web/pages/documents/[id]/index.tsx
index 56e8e2989..2b1121c9b 100644
--- a/apps/web/pages/documents/[id]/index.tsx
+++ b/apps/web/pages/documents/[id]/index.tsx
@@ -16,10 +16,7 @@ import { getDocument } from "@documenso/lib/query";
import { Document as PrismaDocument } from "@prisma/client";
import { Button, Breadcrumb } from "@documenso/ui";
import short from "short-uuid";
-
-const PDFViewer = dynamic(() => import("../../../components/pdf-viewer"), {
- ssr: false,
-});
+import PDFEditor from "../../../components/editor/pdf-editor";
const DocumentsDetailPage: NextPageWithLayout = (props: any) => {
const router = useRouter();
@@ -94,10 +91,7 @@ const DocumentsDetailPage: NextPageWithLayout = (props: any) => {
);
@@ -131,6 +125,12 @@ export async function getServerSideProps(context: any) {
// todo optimize querys
// todo no intersection groups
+ if (!document) {
+ return {
+ notFound: true,
+ };
+ }
+
return {
props: {
document: document,
diff --git a/packages/features/updateUser.ts b/packages/features/updateUser.ts
index 9075c4e94..a09793363 100644
--- a/packages/features/updateUser.ts
+++ b/packages/features/updateUser.ts
@@ -2,22 +2,18 @@ import toast from "react-hot-toast";
export const updateUser = async (user: any) => {
if (!user) return;
- toast
- .promise(
- fetch("/api/users", {
- method: "PATCH",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify(user),
- }),
- {
- loading: "Saving Changes...",
- success: `Saved!`,
- error: "Changes could not save user :/",
- }
- )
- .then(() => {
- // location.reload();
- });
+ toast.promise(
+ fetch("/api/users", {
+ method: "PATCH",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(user),
+ }),
+ {
+ loading: "Saving Changes...",
+ success: `Saved!`,
+ error: "Changes could not save user :/",
+ }
+ );
};
diff --git a/packages/lib/query/getDocument.ts b/packages/lib/query/getDocument.ts
index f922f4c28..d19555f62 100644
--- a/packages/lib/query/getDocument.ts
+++ b/packages/lib/query/getDocument.ts
@@ -12,7 +12,7 @@ export const getDocument = async (
if (!documentId) Promise.reject("No documentId");
if (!req || !res) Promise.reject("No res or req");
- const document: PrismaDocument = await prisma.document.findFirstOrThrow({
+ const document: PrismaDocument = await prisma.document.findFirst({
where: {
id: documentId,
userId: user.id,
diff --git a/packages/ui/components/button/Button.tsx b/packages/ui/components/button/Button.tsx
index 097580311..d5f9bb74d 100644
--- a/packages/ui/components/button/Button.tsx
+++ b/packages/ui/components/button/Button.tsx
@@ -35,6 +35,7 @@ export function Button(props: any) {
) : (