From e55cb6082ad1a2f5ded079f5eb22605f6684a95f Mon Sep 17 00:00:00 2001 From: xmdhs Date: Mon, 16 Oct 2023 16:40:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9B=B4=E6=94=B9=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E5=90=8E=E9=94=99=E8=AF=AF=E7=9A=84=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/profile/Security.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/profile/Security.tsx b/frontend/src/views/profile/Security.tsx index 71ad72f..94f405c 100644 --- a/frontend/src/views/profile/Security.tsx +++ b/frontend/src/views/profile/Security.tsx @@ -71,13 +71,15 @@ function ChangePasswd() { if (pass.pass1 != pass.pass2) return if (load) return setLoad(true) - changePasswd(pass.old, pass.pass1, nowToken).catch(e => { + changePasswd(pass.old, pass.pass1, nowToken) + .then(() => [navigate("/login"), setToken(""), setUser({ name: "", uuid: "" })]) + .catch(e => { if (e instanceof ApiErr && e.code == 6) { setOldPassErr(true) return } setLayoutErr(String(e)) - }).finally(() => setLoad(false)).then(() => [navigate("/login"), setToken(""), setUser({ name: "", uuid: "" })]) + }).finally(() => setLoad(false)) }