I did try to call the api
export const users = {
list: () => http.get('users').then(r => r.data),
console.log( users.list());
and in the console I did get such result.
Promise {<pending>} [[Prototype]] : Promise [[PromiseState]] : "fulfilled" [[PromiseResult]] : Object data : (14) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}] [[Prototype]] : Object
And I have question hot to get result the data from it like count of item or another from ‘Object data’ for example
2
Answers
accessing the data property using dot notation
access the resolved value of the promise via
.then()
, the resolved value is the response objectYou can give a try like this:
If you have users module then import it first at imports section!