SyQual 10 S.A.S
SyQual 10 S.A.S

Reputation: 75

Cannot destructure property `auth` of 'undefined' or 'null'

I am trying to call the user's data from the controller, but I get the following error Can not destructure property auth of 'undefined' or 'null'.

async datosPersona({ auth }) {
    console.log(auth.username)
}

async datosPersona({ auth }) {
}

either of the two examples throws the same error

I'm using adonisjs

Upvotes: 1

Views: 6216

Answers (1)

Michael Lorton
Michael Lorton

Reputation: 44436

The problem is in the call. Somewhere you are doing the equivalent of

 datosPersona(undefined)

Upvotes: 1

Related Questions