mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-05-06 20:19:58 -05:00
Fixed a bug in the ConfigContext.jsx
This commit is contained in:
@@ -13,16 +13,16 @@ export const ConfigProvider = (props) => {
|
||||
const reloadConfig = () => {
|
||||
request("/config").then(async res => {
|
||||
if (res.status === 401) throw 1;
|
||||
if (!res.ok) throw 5;
|
||||
if (!res.ok) throw 2;
|
||||
|
||||
try {
|
||||
return JSON.parse(await res.text());
|
||||
} catch (e) {
|
||||
throw 5;
|
||||
throw 2;
|
||||
}
|
||||
})
|
||||
.then(result => setConfig(result))
|
||||
.catch((code) => setDialog(code === 5 ? apiErrorDialog() : passwordRequiredDialog()));
|
||||
.catch((code) => setDialog(code === 1 ? passwordRequiredDialog() : apiErrorDialog()));
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user