修复更新cron , fix #32

This commit is contained in:
whyour 2021-04-11 20:46:47 +08:00
parent 17c50d0c9e
commit 947a753610
3 changed files with 9 additions and 1 deletions

View File

@ -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;
}

View File

@ -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
>
<Form

View File

@ -14,8 +14,10 @@ const CronModal = ({
handleCancel: (needUpdate?: boolean) => 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
>
<Form form={form} layout="vertical" name="form_in_modal" preserve={false}>