Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const addAttachment: (
  2.   file: File,
  3.   id: number,
  4.   channel?: Channel,
  5. ) => ApiAction<AddAttachmentActionTypes> = (
  6.   file,
  7.   id,
  8.   channel = Channel.POS,
  9. ) => async (dispatch, getState) => {
  10.   dispatch(actions.resetExternalLink());
  11.  
  12.   const { data } = await api.uploadAttachment(getFormData(file));
  13.   dispatch(actions.receiveExternalLink(data.uploadedFiles[0].externalLink));
  14.  
  15.   const body = {
  16.     attachment: data.uploadedFiles[0].externalLink,
  17.     caseId: id,
  18.     userChannel: channel,
  19.   };
  20.   await api.addAttachment(body, channel);
  21.   dispatch(actions.addAttachment());
  22. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement