Skip to content

Commit 8719c58

Browse files
committed
fix: Settings toggle not persisting due to type mismatch
The backend returns raw `true` which axios parses as boolean, but the frontend compared with strict string equality (`=== "true"`). Use `String()` coercion so the check works with both boolean and string responses.
1 parent d221b4b commit 8719c58

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

web/src/Components/Sider/layout.sider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const LayoutSider = (props: LayoutSiderProps) => {
6262
useEffect(() => {
6363
get(`national/Settings/query?id=${CADT_EXPORT_SETTING_ID}`)
6464
.then((resp: any) => {
65-
if (resp?.data === "true") setCadtEnabled(true);
65+
if (String(resp?.data) === "true") setCadtEnabled(true);
6666
})
6767
.catch(() => {});
6868
}, []);

web/src/Pages/Settings/settings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const Settings = (props: any) => {
2020
useEffect(() => {
2121
get(`national/Settings/query?id=${CADT_EXPORT_SETTING_ID}`)
2222
.then((resp: any) => {
23-
if (resp?.data === "true") {
23+
if (String(resp?.data) === "true") {
2424
setCadtEnabled(true);
2525
}
2626
})

0 commit comments

Comments
 (0)