Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const addAttachment: (
- file: File,
- id: number,
- channel?: Channel,
- ) => ApiAction<AddAttachmentActionTypes> = (
- file,
- id,
- channel = Channel.POS,
- ) => async (dispatch, getState) => {
- dispatch(actions.resetExternalLink());
- const { data } = await api.uploadAttachment(getFormData(file));
- dispatch(actions.receiveExternalLink(data.uploadedFiles[0].externalLink));
- const body = {
- attachment: data.uploadedFiles[0].externalLink,
- caseId: id,
- userChannel: channel,
- };
- await api.addAttachment(body, channel);
- dispatch(actions.addAttachment());
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement