Home > OS >  Use object destructuring prefer-destructuring
Use object destructuring prefer-destructuring

Time:03-19

I am codding first time on Vue.js and I have problem. Can you describe me the solution or problem.enter image description here

CodePudding user response:

const { data } = await ...

Use this in 108 and 97 lines.

CodePudding user response:

Your promise object has a data element. Currently, you are accessing your data element using dot (.) syntax. ( Your promise object.data is returning data).

You can use object destructuring to directly access the data element from inside your promise object

const { data } = (await this.$api.auth.sighIN({
    email: this.email,
    password: this.form.password,
}));
  • Related