优化:登录页面长时间停留导致 CSRF 失效时自动显示中文提示并刷新

This commit is contained in:
2026-04-02 09:10:49 +08:00
parent f0d92b21be
commit 3a460b9ac6

View File

@@ -452,6 +452,14 @@
body
})))
.then(result => {
if (result.status === 419 || (result.body && result.body.message === 'CSRF token mismatch.')) {
showAlert('安全令牌已过期,正在自动刷新...', 'error');
setTimeout(() => {
window.location.reload();
}, 1500);
return;
}
if (result.status === 200 && result.body.status === 'success') {
showAlert(result.body.message, 'success');
const chatUrl = '/room/' + roomId;