summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pages/projects/tags/remove_tag.js
blob: 7e83dbe0565de3fb594f0852a481b1f1bef02a34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import initConfirmModal from '~/confirm_modal';

export const initRemoveTag = ({ onDelete = () => {} }) => {
  return initConfirmModal({
    handleSubmit: (path = '') =>
      axios
        .delete(path)
        .then(() => onDelete(path))
        .catch(({ response: { data } }) => {
          const { message } = data;
          createFlash({ message });
        }),
  });
};