Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: return on 200 not just 201

Marc Seitz275fa393bff9
diff --git a/components/account/upload-avatar.tsx b/components/account/upload-avatar.tsx
index 505d5ace..79272106 100644
--- a/components/account/upload-avatar.tsx
+++ b/components/account/upload-avatar.tsx
@@ -59,13 +59,13 @@ const UploadAvatar = ({
body: JSON.stringify({ image: blobUrl }),
}).then(async (res) => {
setUploading(false);
- if (res.status === 201) {
- await update();
- toast.success("Successfully updated your profile picture!");
- } else {
+ if (!res.ok) {
const errorMessage = await res.text();
toast.error(errorMessage || "Something went wrong");
+ return;
}
+ await update();
+ toast.success("Successfully updated your profile picture!");
});
}}
className="rounded-lg"
diff --git a/pages/api/account/index.ts b/pages/api/account/index.ts
index 9e301569..c66a50d3 100644
--- a/pages/api/account/index.ts
+++ b/pages/api/account/index.ts
@@ -99,7 +99,7 @@ export default async function handle(
},
});
- return res.status(200).json(response);
+ return res.status(200).json({ message: "success" });
} catch (error) {
errorhandler(error, res);
}