mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-18 18:44:33 +08:00
umi-request 替换为 axios
This commit is contained in:
@@ -184,11 +184,9 @@ const CronDetailModal = ({
|
||||
return new Promise((resolve, reject) => {
|
||||
request
|
||||
.put(`${config.apiPrefix}scripts`, {
|
||||
data: {
|
||||
filename: scriptInfo.filename,
|
||||
path: scriptInfo.parent || '',
|
||||
content,
|
||||
},
|
||||
filename: scriptInfo.filename,
|
||||
path: scriptInfo.parent || '',
|
||||
content,
|
||||
})
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
@@ -220,7 +218,7 @@ const CronDetailModal = ({
|
||||
),
|
||||
onOk() {
|
||||
request
|
||||
.put(`${config.apiPrefix}crons/run`, { data: [currentCron.id] })
|
||||
.put(`${config.apiPrefix}crons/run`, [currentCron.id])
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
setCurrentCron({ ...currentCron, status: CrontabStatus.running });
|
||||
@@ -250,7 +248,7 @@ const CronDetailModal = ({
|
||||
),
|
||||
onOk() {
|
||||
request
|
||||
.put(`${config.apiPrefix}crons/stop`, { data: [currentCron.id] })
|
||||
.put(`${config.apiPrefix}crons/stop`, [currentCron.id] )
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
setCurrentCron({ ...currentCron, status: CrontabStatus.idle });
|
||||
@@ -282,9 +280,7 @@ const CronDetailModal = ({
|
||||
`${config.apiPrefix}crons/${
|
||||
currentCron.isDisabled === 1 ? 'enable' : 'disable'
|
||||
}`,
|
||||
{
|
||||
data: [currentCron.id],
|
||||
},
|
||||
[currentCron.id],
|
||||
)
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
@@ -320,9 +316,7 @@ const CronDetailModal = ({
|
||||
`${config.apiPrefix}crons/${
|
||||
currentCron.isPinned === 1 ? 'unpin' : 'pin'
|
||||
}`,
|
||||
{
|
||||
data: [currentCron.id],
|
||||
},
|
||||
[currentCron.id],
|
||||
)
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
|
||||
@@ -457,7 +457,7 @@ const Crontab = () => {
|
||||
),
|
||||
onOk() {
|
||||
request
|
||||
.put(`${config.apiPrefix}crons/run`, { data: [record.id] })
|
||||
.put(`${config.apiPrefix}crons/run`, [record.id])
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
const result = [...value];
|
||||
@@ -492,7 +492,7 @@ const Crontab = () => {
|
||||
),
|
||||
onOk() {
|
||||
request
|
||||
.put(`${config.apiPrefix}crons/stop`, { data: [record.id] })
|
||||
.put(`${config.apiPrefix}crons/stop`, [record.id])
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
const result = [...value];
|
||||
@@ -533,9 +533,7 @@ const Crontab = () => {
|
||||
`${config.apiPrefix}crons/${
|
||||
record.isDisabled === 1 ? 'enable' : 'disable'
|
||||
}`,
|
||||
{
|
||||
data: [record.id],
|
||||
},
|
||||
[record.id],
|
||||
)
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
@@ -577,9 +575,7 @@ const Crontab = () => {
|
||||
`${config.apiPrefix}crons/${
|
||||
record.isPinned === 1 ? 'unpin' : 'pin'
|
||||
}`,
|
||||
{
|
||||
data: [record.id],
|
||||
},
|
||||
[record.id],
|
||||
)
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
@@ -725,9 +721,10 @@ const Crontab = () => {
|
||||
content: <>确认{OperationName[operationStatus]}选中的定时任务吗</>,
|
||||
onOk() {
|
||||
request
|
||||
.put(`${config.apiPrefix}crons/${OperationPath[operationStatus]}`, {
|
||||
data: selectedRowIds,
|
||||
})
|
||||
.put(
|
||||
`${config.apiPrefix}crons/${OperationPath[operationStatus]}`,
|
||||
selectedRowIds,
|
||||
)
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
getCrons();
|
||||
|
||||
@@ -25,9 +25,10 @@ const CronModal = ({
|
||||
payload.id = cron.id;
|
||||
}
|
||||
try {
|
||||
const { code, data } = await request[method](`${config.apiPrefix}crons`, {
|
||||
data: payload,
|
||||
});
|
||||
const { code, data } = await request[method](
|
||||
`${config.apiPrefix}crons`,
|
||||
payload,
|
||||
);
|
||||
|
||||
if (code === 200) {
|
||||
message.success(cron ? '更新Cron成功' : '新建Cron成功');
|
||||
@@ -130,9 +131,7 @@ const CronLabelModal = ({
|
||||
try {
|
||||
const { code, data } = await request[action](
|
||||
`${config.apiPrefix}crons/labels`,
|
||||
{
|
||||
data: payload,
|
||||
},
|
||||
payload,
|
||||
);
|
||||
|
||||
if (code === 200) {
|
||||
|
||||
@@ -80,9 +80,7 @@ const ViewCreateModal = ({
|
||||
try {
|
||||
const { code, data } = await request[method](
|
||||
`${config.apiPrefix}crons/views`,
|
||||
{
|
||||
data: view ? { ...values, id: view.id } : values,
|
||||
},
|
||||
view ? { ...values, id: view.id } : values,
|
||||
);
|
||||
|
||||
if (code === 200) {
|
||||
|
||||
@@ -168,9 +168,9 @@ const ViewManageModal = ({
|
||||
|
||||
const onShowChange = (checked: boolean, record: any, index: number) => {
|
||||
request
|
||||
.put(`${config.apiPrefix}crons/views/${checked ? 'enable' : 'disable'}`, {
|
||||
data: [record.id],
|
||||
})
|
||||
.put(`${config.apiPrefix}crons/views/${checked ? 'enable' : 'disable'}`, [
|
||||
record.id,
|
||||
])
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
const _list = [...list];
|
||||
@@ -195,7 +195,9 @@ const ViewManageModal = ({
|
||||
const dragRow = list[dragIndex];
|
||||
request
|
||||
.put(`${config.apiPrefix}crons/views/move`, {
|
||||
data: { fromIndex: dragIndex, toIndex: hoverIndex, id: dragRow.id },
|
||||
fromIndex: dragIndex,
|
||||
toIndex: hoverIndex,
|
||||
id: dragRow.id,
|
||||
})
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
|
||||
Reference in New Issue
Block a user