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