更新cookie管理添加cookie逻辑

This commit is contained in:
whyour
2021-03-17 00:35:14 +08:00
parent 7f7d4d4f24
commit 8526a57caf
5 changed files with 112 additions and 116 deletions
+9 -7
View File
@@ -70,19 +70,24 @@ const Config = () => {
const getCookie = async (modal: { destroy: () => void }) => {
for (let i = 0; i < 50; i++) {
const result = await request.get(`${config.apiPrefix}cookie`);
console.log(i, result);
if (result && result.cookie) {
const {
data: { cookie, errcode, message },
} = await request.get(`${config.apiPrefix}cookie`);
if (cookie) {
notification.success({
message: 'Cookie获取成功',
});
modal.destroy();
Modal.success({
title: '获取Cookie成功',
content: <div>{result.cookie}</div>,
content: <div>{cookie}</div>,
});
break;
}
if (errcode !== 176) {
notification.error({ message });
break;
}
await sleep(2000);
}
};
@@ -109,9 +114,6 @@ const Config = () => {
<Button key="1" type="primary" onClick={updateConfig}>
</Button>,
<Button key="2" type="primary" onClick={showQrCode}>
Cookie
</Button>,
]}
header={{
style: {