Reputation: 103
I successfully get data from the WordPress rest API
auth: {
strategies: {
local: {
endpoints: {
login: { url: 'http://localhost/wordpress/wp-json/jwt-auth/v1/token', method: 'post', propertyName: 'token' },
user: {url: 'http://localhost/wordpress/wp-json/wp/v2/users/me/', method: 'post', propertyName: false },
tokenRequired: true,
tokenType: 'Bearer',
globalToken: true,
}
}
},
}
But in the index page view, isLogged is always false.
computed: {
isLogged() {
return this.$auth.loggedIn;
}
},
In the nuxt.config.js target is set to 'static'.
I have no idea where is the problem and how could I fix it.
Upvotes: 0
Views: 538
Reputation: 103
I found the problem. I install the wrong module. If anyone got the same problem, make sure you install '@nuxtjs/auth'
Upvotes: 1