Fix error handling and revert mode in AdminUiHandler
This commit is contained in:
parent
e4da48f51a
commit
8bf44a2047
|
@ -64,12 +64,13 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
||||||
Utils.apiPost("admin/account/discord-link", `username=${encodeURIComponent(this.inputs[0].text)}&discordId=${encodeURIComponent(this.inputs[1].text)}`, "application/x-www-form-urlencoded", true)
|
Utils.apiPost("admin/account/discord-link", `username=${encodeURIComponent(this.inputs[0].text)}&discordId=${encodeURIComponent(this.inputs[1].text)}`, "application/x-www-form-urlencoded", true)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
return response.text();
|
console.error(response);
|
||||||
}
|
}
|
||||||
return response.json();
|
this.scene.ui.revertMode();
|
||||||
})
|
})
|
||||||
.then(response => {
|
.catch((err) => {
|
||||||
this.scene.ui.setMode(Mode.ADMIN, config);
|
console.error(err);
|
||||||
|
this.scene.ui.revertMode();
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue