Skip to content

Commit

Permalink
feat(antd): 删除提示
Browse files Browse the repository at this point in the history
  • Loading branch information
stbui committed Sep 12, 2019
1 parent d9c849b commit 3fd0cd1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
12 changes: 11 additions & 1 deletion packages/antd/src/button/DeleteWithButton.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import React from 'react';
import { useDeleteController } from 'prophet-core';
import { message } from 'antd';
import { Link } from '../Link';

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

const onConfirm = () => update(record);
const onConfirm = () =>
update(record.id, record, {
onSuccess() {
message.info('删除成功');
},
onFailure(error) {
message.error(error.message);
},
refresh: true,
});

return (
<Link
Expand Down
13 changes: 11 additions & 2 deletions packages/antd/src/button/DeleteWithConfirmButton.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import React from 'react';
import { useDeleteController } from 'prophet-core';
import { Popconfirm } from 'antd';
import { Popconfirm, message } from 'antd';
import { Link } from '../Link';

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

const onConfirm = () => update(record.id, record, { refresh: true });
const onConfirm = () =>
update(record.id, record, {
onSuccess() {
message.info('删除成功');
},
onFailure(error) {
message.error(error.message);
},
refresh: true,
});

return (
<Popconfirm
Expand Down

0 comments on commit 3fd0cd1

Please sign in to comment.