ui: use Async tools from widget toolkit
The api2 one passes the whole response (for more flexibility) on reject, so we need to adapt to that. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
@ -51,12 +51,12 @@ Ext.define('PBS.window.AddTfaRecovery', {
|
||||
let view = me.getView();
|
||||
|
||||
try {
|
||||
await PBS.Async.api2({
|
||||
await Proxmox.Async.api2({
|
||||
url: `${view.url}/${userid}/recovery`,
|
||||
method: 'GET',
|
||||
});
|
||||
return true;
|
||||
} catch (_ex) {
|
||||
} catch (_response) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
@ -62,7 +62,7 @@ Ext.define('PBS.window.AddWebauthn', {
|
||||
me.getView().mask(gettext('Please wait...'), 'x-mask-loading');
|
||||
|
||||
try {
|
||||
let register_response = await PBS.Async.api2({
|
||||
let register_response = await Proxmox.Async.api2({
|
||||
url: `/api2/extjs/access/tfa/${userid}`,
|
||||
method: 'POST',
|
||||
params: values,
|
||||
@ -135,12 +135,13 @@ Ext.define('PBS.window.AddWebauthn', {
|
||||
params.password = values.password;
|
||||
}
|
||||
|
||||
await PBS.Async.api2({
|
||||
await Proxmox.Async.api2({
|
||||
url: `/api2/extjs/access/tfa/${userid}`,
|
||||
method: 'POST',
|
||||
params,
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (response) {
|
||||
let error = response.result.message;
|
||||
console.error(error); // for debugging if it's not displayable...
|
||||
Ext.Msg.alert(gettext('Error'), error);
|
||||
}
|
||||
|
Reference in New Issue
Block a user