How to return boolean with axios

Viewed 8772

In VueJS I am trying to return a boolean with axios

allContactsSaved() {
    let promise = axios.get('/contacts');
    console.log(promise.then(function (response) {
        response.data.data.forEach(function(contact) {
          if (!contact.saved) {
            return false;
          }
        });
        return true;
    }));
  }

The console.log is just returning

Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}

But I want either true or false in return.

2 Answers
Related