Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. async myFunction(context) {
  2.     try {
  3.         const data = {
  4.             some: 'data'
  5.         };
  6.         await axios.post(data);
  7.         await new Promise(resolve => {
  8.             setTimeout(() => {
  9.                 context.commit('anotherFunction');
  10.                 setTimeout(() => {
  11.                     resetSomeState();
  12.                     resolve();
  13.                 }, 1000);
  14.             }, 1000);
  15.         });
  16.     } catch(e) {
  17.         logError(e);
  18.         reject(e);
  19.     }
  20. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement