npm @navjobs/upload 2.0.0

latest releases: 3.2.0, 3.1.3, 3.1.2...
7 years ago

This release paves the way for a signed upload component. The goal is to hit your api before the upload, it returns a signed url for google cloud or aws, and then after the upload, hit your api again to set the upload to finished.

New Features

  • returning a promise (async function) from onComplete prop will keep the upload state in progress until it completes.
  • When progress is started, 0.1 is sent instead of 0. This means no more if(progress || progress === 0) to check for an in progress status
  • triggerProgress function. Allows you to do something like this:
onClick={async () => {
  triggerProgress();
  let data = await someRequest()
  startUpload({
    ...data,
    content_type: files[0].type,
  });
}}

If you are uploading files with signed urls, you will need to post to your backend to generate them for google cloud and s3, hence the reason to trigger in progress ahead of time.

Breaking change

  • onComplete now returns an object, with response, status, and data, a new parameter described above. To update to v2, change this:
onComplete={(response, status) => ...

to

onComplete={({ response, status }) => ...

Don't miss a new upload release

NewReleases is sending notifications on new releases.