I'm trying to deploy the nuxtjs project that I'm working on. I tried nuxt generate.
Then I uploaded the file to our apache server.
when I tried to login using Laravel sanctum, it gives me success login. However, Nuxt doesn't seem to fire the user strategy to get the login user.
Here's my code.
LOGIN:
methods: {
async login() {
let valid = this.$refs.form.validate();
if (valid) {
this.isLoggingIn = true;
try {
await this.$auth.loginWith('laravelSanctum', {
data:{
email: this.email,
password: this.password
}
}).then(async ()=>{
if(this.$auth.user.init_page !== null)
await this.$router.push(this.$auth.user.init_page)
else
await this.$router.push('/')
});
} catch (e) {
if (!e.response.data.message)
this.alert.message = "Unknown error occurred. Please contact admin."
this.alert.message = e.response.data.message;
this.alert.shown = true;
} finally {
this.isLoggingIn = false;
}
}
}
}
nuxt.config.js
strategies: {
'laravelSanctum': {
provider: 'laravel/sanctum',
url: 'http://localhost:8000',
endpoints: {
login: {
url: '/api/login'
},
logout: {
url: '/api/logout'
},
user: {
url: '/api/user'
}
}
}
}

