import { message } from '@/common/one-ui'
import FlowService from '@/webflow/flow-service'
export default function({ button }) {
  const key = 'key'
  const duration = 1
  message.loading({ content: '处理中...', key, duration })
  const params = {
    formId: this.FlowData.processFormData.formId,
    beanType: this.FlowData.processFormData.beanId,
  }
  return FlowService.cancelFavorities(params)
    .then((res) => {
      // @ts-ignore
      message.success({ content: '取消收藏成功', key, duration }).then(() => {
        this.updateFlow()
      })
    })
    .catch((e) => {
      message.error({ content: '取消收藏失败', key, duration })
    })
}
