Add HTTP error handling to settings API fetch

This commit is contained in:
nyatoru
2026-02-23 06:38:45 +07:00
parent f0a0c97b5e
commit bd4a076942

View File

@@ -12,7 +12,12 @@ export default function AppearanceTab() {
useEffect(() => {
fetch("/api/settings")
.then((res) => res.json())
.then((res) => {
if (!res.ok) {
throw new Error(`HTTP error ${res.status}`);
}
return res.json();
})
.then((data) => {
setSettings(data);
setLoading(false);