From 947a75361088f288f7d1e75f23bdf3ca9ca484aa Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 11 Apr 2021 20:46:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9B=B4=E6=96=B0cron=20,=20?= =?UTF-8?q?fix=20#32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/cron.ts | 2 +- src/pages/cookie/modal.tsx | 4 ++++ src/pages/crontab/modal.tsx | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/back/services/cron.ts b/back/services/cron.ts index 5ea4dcfc..da084bab 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -48,7 +48,7 @@ export default class CronService { const doc = await this.get(_id); const tab = new Crontab({ ...doc, ...other }); tab.saved = false; - const newDoc = await this.update(tab); + const newDoc = await this.updateDb(tab); await this.set_crontab(); return newDoc; } diff --git a/src/pages/cookie/modal.tsx b/src/pages/cookie/modal.tsx index aa21d609..b8731a48 100644 --- a/src/pages/cookie/modal.tsx +++ b/src/pages/cookie/modal.tsx @@ -13,6 +13,7 @@ const CookieModal = ({ handleCancel: (needUpdate?: boolean) => void; }) => { const [form] = Form.useForm(); + const [loading, setLoading] = useState(false); const handleOk = async (values: any) => { const cookies = values.value @@ -29,6 +30,7 @@ const CookieModal = ({ if (flag) { return; } + setLoading(true); const method = cookie ? 'put' : 'post'; const payload = cookie ? { value: cookies[0], _id: cookie._id } : cookies; const { code, data } = await request[method](`${config.apiPrefix}cookies`, { @@ -43,6 +45,7 @@ const CookieModal = ({ message: data, }); } + setLoading(false); handleCancel(data); }; @@ -66,6 +69,7 @@ const CookieModal = ({ }); }} onCancel={() => handleCancel()} + confirmLoading={loading} destroyOnClose >
void; }) => { const [form] = Form.useForm(); + const [loading, setLoading] = useState(false); const handleOk = async (values: any) => { + setLoading(true); const method = cron ? 'put' : 'post'; const payload = { ...values }; if (cron) { @@ -33,6 +35,7 @@ const CronModal = ({ message: data, }); } + setLoading(false); handleCancel(data); }; @@ -60,6 +63,7 @@ const CronModal = ({ }); }} onCancel={() => handleCancel()} + confirmLoading={loading} destroyOnClose >