Skip to content

Commit 3fd0cd1

Browse files
committed
feat(antd): 删除提示
1 parent d9c849b commit 3fd0cd1

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

packages/antd/src/button/DeleteWithButton.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
import React from 'react';
22
import { useDeleteController } from 'prophet-core';
3+
import { message } from 'antd';
34
import { Link } from '../Link';
45

56
export const DeleteWithButtonView = props => {
67
const { label, disabled, className, style, update, record } = props;
78

8-
const onConfirm = () => update(record);
9+
const onConfirm = () =>
10+
update(record.id, record, {
11+
onSuccess() {
12+
message.info('删除成功');
13+
},
14+
onFailure(error) {
15+
message.error(error.message);
16+
},
17+
refresh: true,
18+
});
919

1020
return (
1121
<Link

packages/antd/src/button/DeleteWithConfirmButton.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
import React from 'react';
22
import { useDeleteController } from 'prophet-core';
3-
import { Popconfirm } from 'antd';
3+
import { Popconfirm, message } from 'antd';
44
import { Link } from '../Link';
55

66
export const DeleteWithConfirmButton = props => {
77
const { label, disabled, className, style, update, record } = props;
88

9-
const onConfirm = () => update(record.id, record, { refresh: true });
9+
const onConfirm = () =>
10+
update(record.id, record, {
11+
onSuccess() {
12+
message.info('删除成功');
13+
},
14+
onFailure(error) {
15+
message.error(error.message);
16+
},
17+
refresh: true,
18+
});
1019

1120
return (
1221
<Popconfirm

0 commit comments

Comments
 (0)