Reload page instead of hard code to '/login' when requests failed
This commit is contained in:
@@ -422,13 +422,13 @@
|
||||
})
|
||||
.then((resp) => {
|
||||
if (resp.status !== 200) {
|
||||
location.href = './login'
|
||||
location.reload();
|
||||
return
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
location.href = './login'
|
||||
console.error(e)
|
||||
location.reload();
|
||||
return
|
||||
});
|
||||
}
|
||||
|
||||
@@ -429,7 +429,11 @@
|
||||
credentials: 'include',
|
||||
method: "POST",
|
||||
body: JSON.stringify(editedClient)
|
||||
}).finally(() => {
|
||||
})
|
||||
.catch(err => {
|
||||
alert(this.i18n.t('pin.save_client_error') + err);
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
this.refreshClients();
|
||||
}, 1000);
|
||||
@@ -518,6 +522,10 @@
|
||||
} else {
|
||||
this.clients = [];
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
console.error(e)
|
||||
location.reload();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
@@ -429,6 +429,7 @@
|
||||
"otp_pair_now": "PIN generated successfully, do you want to pair now?",
|
||||
"device_management": "Device Management",
|
||||
"device_management_desc": "Manage your paired devices.",
|
||||
"save_client_error": "Error while saving client: ",
|
||||
"unpair_all": "Unpair All",
|
||||
"unpair_all_success": "All devices unpaired.",
|
||||
"unpair_all_error": "Error while unpairing",
|
||||
|
||||
@@ -429,6 +429,7 @@
|
||||
"otp_pair_now": "PIN 请求成功,是否一键配对?",
|
||||
"device_management": "设备管理",
|
||||
"device_management_desc": "管理已配对的设备。",
|
||||
"save_client_error": "保存客户端时出错:",
|
||||
"unpair_all": "全部取消配对",
|
||||
"unpair_all_success": "全部取消配对成功!",
|
||||
"unpair_all_error": "取消配对时出错",
|
||||
|
||||
@@ -148,7 +148,6 @@
|
||||
this.refreshLogs();
|
||||
}, 5000);
|
||||
this.refreshLogs();
|
||||
this.refreshClients();
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearInterval(this.logInterval);
|
||||
@@ -190,14 +189,14 @@
|
||||
})
|
||||
.then((resp) => {
|
||||
if (resp.status !== 200) {
|
||||
location.href = './login'
|
||||
location.reload();
|
||||
return
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
this.serverRestarting = false
|
||||
location.href = './login'
|
||||
console.error(e)
|
||||
location.reload();
|
||||
return
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user