diff --git a/src/app/(pages)/page.tsx b/src/app/(pages)/page.tsx index 936001c..1ac271a 100644 --- a/src/app/(pages)/page.tsx +++ b/src/app/(pages)/page.tsx @@ -18,15 +18,6 @@ export default function Home(): ReactElement { return; } - // Limit the paste size to 400,000 characters - if (value.length > 400_000) { - toast({ - title: "Paste", - description: "Pastes can't be longer than 400,000 characters", - }); - return; - } - // Upload the paste to the server const response = await fetch( `${process.env.NEXT_PUBLIC_API_ENDPOINT}/upload`, @@ -39,8 +30,17 @@ export default function Home(): ReactElement { }, ); - // Redirect to the new paste const data = await response.json(); + + if (!response.ok) { + toast({ + title: "Paste", + description: data.message, + }); + return; + } + + // Redirect to the new paste window.location.href = `/${data.id}`; }