chore: update token related logic

This commit is contained in:
JustSong
2022-11-11 20:02:28 +08:00
parent e1d09aa58f
commit d42b4511cf
6 changed files with 71 additions and 55 deletions
+1 -13
View File
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import { Button, Form, Image, Modal } from 'semantic-ui-react';
import { Link } from 'react-router-dom';
import { API, copy, showError, showSuccess } from '../helpers';
import { API, showError, showSuccess } from '../helpers';
const PersonalSetting = () => {
const [inputs, setInputs] = useState({
@@ -25,17 +25,6 @@ const PersonalSetting = () => {
setInputs((inputs) => ({ ...inputs, [name]: value }));
};
const generateToken = async () => {
const res = await API.get('/api/user/token');
const { success, message, data } = res.data;
if (success) {
await copy(data);
showSuccess(`令牌已重置并已复制到剪切板:${data}`);
} else {
showError(message);
}
};
const bindWeChat = async () => {
if (inputs.wechat_verification_code === '') return;
const res = await API.get(
@@ -86,7 +75,6 @@ const PersonalSetting = () => {
<Button as={Link} to={`/user/edit/`}>
更新个人信息
</Button>
<Button onClick={generateToken}>生成访问令牌</Button>
<Button
onClick={() => {
setShowWeChatBindModal(true);