

export class FileUploader {
    // static async uploadImageBase64(mimeType, fileBase64Data) {
    //   const data = new FormData();
    //   data.append(
    //     'image',
    //     `data:${mimeType};base64,${encodeURIComponent(fileBase64Data)}`,
    //   );
  
    //   const resposne = await fetch(api.upload.base64, {
    //     method: 'POST',
    //     body: data,
    //   });
    //   const json = await resposne.json();
    //   console.log('image uploaded ' +` ${api.s3Url}/${json.bucketPath}`);
    //   return `${api.s3Url}/${json.bucketPath}`;
    // }
  
    // convertDataURIToBinary(dataURI) {
    //   var BASE64_MARKER = ';base64,';
    //   var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
    //   var base64 = dataURI.substring(base64Index);
    //   var raw = window.atob(base64);
    //   var rawLength = raw.length;
    //   var array = new Uint8Array(new ArrayBuffer(rawLength));
  
    //   for (let i = 0; i < rawLength; i++) {
    //     array[i] = raw.charCodeAt(i);
    //   }
    //   return array;
    // }
    static uploadFile(url, data, callback){

        fetch('https://dev.api.artishok.io/upload-microservice/upload', {             
                method: 'POST',
                body: data
            }
        ).then((resp) => {

            callback(resp)
            
        }).catch((err) => {
            console.log("file upload err : ", err)
            callback(err)
        })
    }

  }