mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-05-20 13:09:00 -05:00
Moved the change server logic behind the loading process
This commit is contained in:
@@ -136,19 +136,18 @@ function DropdownComponent() {
|
||||
let servers = {};
|
||||
fetch("/api/info/server", {headers: headers})
|
||||
.then(res => res.json())
|
||||
.then(json => servers = json);
|
||||
|
||||
fetch("/api/config/serverId", {headers: headers}).then(res => res.json())
|
||||
.then(async server => setDialog({
|
||||
title: "Speedtest-Server setzen",
|
||||
select: true,
|
||||
selectOptions: servers,
|
||||
value: server.value,
|
||||
onSuccess: value => {
|
||||
fetch("/api/config/serverId", {headers: headers, method: "PATCH", body: JSON.stringify({value: value})})
|
||||
.then(() => showFeedback());
|
||||
}
|
||||
}));
|
||||
.then(json => servers = json)
|
||||
.then(() => fetch("/api/config/serverId", {headers: headers}).then(res => res.json())
|
||||
.then(async server => setDialog({
|
||||
title: "Speedtest-Server setzen",
|
||||
select: true,
|
||||
selectOptions: servers,
|
||||
value: server.value,
|
||||
onSuccess: value => {
|
||||
fetch("/api/config/serverId", {headers: headers, method: "PATCH", body: JSON.stringify({value: value})})
|
||||
.then(() => showFeedback());
|
||||
}
|
||||
})));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user