import { actionPromise } from "./actionPromise"; export const actionUploadFile = (files) => async (dispatch) => { let fd = new FormData(); fd.append("photo", files); return await dispatch( actionPromise( "upload", fetch("/upload", { method: "POST", headers: localStorage.authToken ? { Authorization: "Bearer " + localStorage.authToken } : {}, body: fd, }).then((res) => res.json()) ) ); };