mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-25 01:16:18 -05:00
Not clearing settings when frontend fails to fetch, this caused the navbar color and such to be forgotten.
This commit is contained in:
parent
f59a4198d9
commit
dd270b37dc
1 changed files with 9 additions and 4 deletions
|
|
@ -1020,9 +1020,12 @@ export const useSettings = () => {
|
|||
}
|
||||
setPending(true);
|
||||
try {
|
||||
setSettings(await getSettings())
|
||||
const newSettings = await getSettings();
|
||||
if (newSettings) {
|
||||
setSettings(newSettings);
|
||||
}
|
||||
} catch (e) {
|
||||
setSettings({});
|
||||
// Don't clear settings on error — keep the last known good values.
|
||||
} finally {
|
||||
setPending(false);
|
||||
}
|
||||
|
|
@ -1056,7 +1059,10 @@ export const useStatus = () => {
|
|||
try {
|
||||
// Fetch from both endpoints in parallel
|
||||
const [appStatus, controllerStats] = await Promise.all([
|
||||
getStatus().catch(e => {
|
||||
getStatus().then(result => {
|
||||
window.apiDown = false;
|
||||
return result;
|
||||
}).catch(e => {
|
||||
if (e instanceof ApiDownError) {
|
||||
window.apiDown = true;
|
||||
return {};
|
||||
|
|
@ -1072,7 +1078,6 @@ export const useStatus = () => {
|
|||
|
||||
// Merge both responses - controller stats override app status for system info
|
||||
setStatus({...appStatus, ...controllerStats});
|
||||
window.apiDown = false;
|
||||
} catch (e) {
|
||||
if (e instanceof ApiDownError) {
|
||||
// API is down, do not log this error.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue