import  {backendURL} from "./gql";

export const uploadFile = (file) => {
    console.log(file)
    const fd = new FormData;
    fd.append('media', file)

    return fetch(`${backendURL}/upload`, {
        method: "POST",
        headers: localStorage.authToken ? {Authorization: 'Bearer ' + localStorage.authToken} : {},
        body: fd
        }).then((res) => res.json())
}