REFACTOR http requests in frontend

This commit is contained in:
2025-07-14 23:06:27 +02:00
parent 416da3281a
commit 0fbb68fdb7
4 changed files with 138 additions and 141 deletions

View File

@@ -10,13 +10,14 @@ const clipUpload = () => {
const [error, setError] = useState<null | string>(null);
const press = (() => {
if (file) {
uploadFile(file, setError)
.then(uuid => navigate(`/create/${uuid}`))
.catch(e => console.error(e));
} else {
if (!file) {
setError("Please choose a file");
return;
}
uploadFile(file)
.then(uuid => navigate(`/create/${uuid}`))
.catch((e: Error) => setError(`Failed to upload file: ${e.message}`));
});
return (