Skip to content

Instantly share code, notes, and snippets.

@andreasvirkus
Created September 26, 2017 11:08
Show Gist options
  • Save andreasvirkus/e3b2b849ed25fa7c04c0caa3fe14498d to your computer and use it in GitHub Desktop.
Save andreasvirkus/e3b2b849ed25fa7c04c0caa3fe14498d to your computer and use it in GitHub Desktop.
import wait from './wait';
//...
save(formData) {
//...
upload(formData)
.then(wait(1500)) // DEV ONLY: wait for 1.5s
.then(x => {
this.uploadedFiles = [].concat(x);
this.currentStatus = STATUS_SUCCESS;
})
//...
},
export default function wait(ms) {
return (x) => {
return new Promise(resolve => setTimeout(() => resolve(x), ms));
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment