mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: custom logo not showing in sidebar and silent upload failures
The desktop sidebar never rendered the custom logo because only mobile views used the customLogo state. Added a logo section at the top of the desktop sidebar that displays the custom logo (or the default OtterLogo when none is set). The upload handler used raw fetch() without checking response.ok, so HTTP 4xx errors (e.g. file too large) were silently ignored and the UI falsely reported success. Now checks response status and surfaces the server error message. Closes #125
This commit is contained in:
@@ -387,11 +387,16 @@ function SystemSection() {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
try {
|
||||
await fetch("/api/v1/settings/logo", {
|
||||
const res = await fetch("/api/v1/settings/logo", {
|
||||
method: "POST",
|
||||
headers: formatHeaders(),
|
||||
body: formData,
|
||||
});
|
||||
if (!res.ok) {
|
||||
const body = await res.json().catch(() => null);
|
||||
setSaveMsg(body?.error || "Failed to upload logo.");
|
||||
return;
|
||||
}
|
||||
setSettings((prev) => ({ ...prev, customLogo: "true" }));
|
||||
} catch {
|
||||
setSaveMsg("Failed to upload logo.");
|
||||
|
||||
Reference in New Issue
Block a user