2 Commits

Author SHA1 Message Date
b22c5e7e50 Merge remote-tracking branch 'origin/master'
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m56s
Publish Docker Image / docker (ubuntu-latest) (push) Successful in 1m33s
2024-04-23 21:23:24 +01:00
4bb16d287b verify paste length on server 2024-04-23 21:23:18 +01:00

View File

@ -18,15 +18,6 @@ export default function Home(): ReactElement {
return; 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 // Upload the paste to the server
const response = await fetch( const response = await fetch(
`${process.env.NEXT_PUBLIC_API_ENDPOINT}/upload`, `${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(); 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}`; window.location.href = `/${data.id}`;
} }