Skip to content

Instantly share code, notes, and snippets.

@andrit
Last active July 11, 2018 17:04
Show Gist options
  • Save andrit/bf290325b3011c8fba2c7e2a9b9441d7 to your computer and use it in GitHub Desktop.
Save andrit/bf290325b3011c8fba2c7e2a9b9441d7 to your computer and use it in GitHub Desktop.
onSubmit = () => {
  return new Promise((resolve,reject) => {
    try{
    // try code here
    console.log('I am in the promise function!');
    resolve('resolved message');
    }
    catch(e){
      reject(e);
      }
});

//Use it...
onSubmit.then(() => {
  console.log('I am in the first resolved promise');
}).then(() => {
  console.log('I am in the second resolved promise');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment