From 905702c15fefa182ea290219f8d9ae525d30fdcc Mon Sep 17 00:00:00 2001
From: Jimmy Liow <18777396951@163.com>
Date: Tue, 16 May 2023 14:08:22 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=E4=BD=BF?=
=?UTF-8?q?=E7=94=A8=20POST=EF=BC=9B=E5=A2=9E=E5=8A=A0=E5=8F=96=E6=B6=88?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/stores/Auth.js | 16 ++++++++--------
src/views/account/ChangePassword.jsx | 6 ++++--
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/stores/Auth.js b/src/stores/Auth.js
index e4ea272..9c8fe24 100644
--- a/src/stores/Auth.js
+++ b/src/stores/Auth.js
@@ -10,7 +10,7 @@ class Auth {
this.root = root;
}
- valdateUserPassword(usr, pwd) {
+ valdateUserPassword(usr, pwd) {
const formData = new FormData();
formData.append('username', usr);
formData.append('Password', pwd);
@@ -53,16 +53,16 @@ class Auth {
}
changeUserPassword(password, newPassword) {
- const fetchUrl = prepareUrl(HT_HOST + '/service-Cooperate/Cooperate/SetPassword')
- .append('UserID', this.login.userId)
- .append('password', password)
- .append('NewPassword', newPassword)
- .build();
+ const formData = new FormData();
+ formData.append('UserID', this.login.userId);
+ formData.append('Password', password);
+ formData.append('NewPassword', newPassword);
+ const postUrl = HT_HOST + '/service-CooperateSOA/SetPassword';
- return fetchJSON(fetchUrl)
+ return postForm(postUrl, formData)
.then(json => {
if (json.errcode == 0) {
- console.info(json);
+ return json;
} else {
throw new Error(json.errmsg + ': ' + json.errcode);
}
diff --git a/src/views/account/ChangePassword.jsx b/src/views/account/ChangePassword.jsx
index fe76a61..14f3c4b 100644
--- a/src/views/account/ChangePassword.jsx
+++ b/src/views/account/ChangePassword.jsx
@@ -1,3 +1,4 @@
+import { useNavigate } from "react-router-dom";
import { Button, Space, Form, Input, Row, Typography, App } from 'antd';
import { useStore } from '@/stores/StoreContext.js';
@@ -5,6 +6,7 @@ const { Title } = Typography;
function ChangePassword() {
+ const navigate = useNavigate();
const { authStore } = useStore();
const { notification } = App.useApp();
const [form] = Form.useForm();
@@ -60,7 +62,7 @@ function ChangePassword() {
},
]}
>
-
+