bradtraversy / microposts_fullstack_vue

Full stack vue and express
172 stars 84 forks source link

Failed to compile. #3

Closed waelio closed 5 years ago

waelio commented 5 years ago

./src/services/historyService.js 19:20 Module parse failed: Can not use keyword 'await' outside an async function (19:20) You may need an appropriate loader to handle this file type.

 return new Promise(function (resolve, reject) {
   try {
      var res = await axios.get(url);
     var data = res.data;
      resolve(data.map(function (history) {
AndreasDeveloper commented 5 years ago

Just simply make function async.

return new Promise(async (resolve, reject) => {...

waelio commented 5 years ago

Thanks