0👍
As user Mihai pointed out, you need to chain your POST request after a get request to csrf.
Here’s how it looks like with Laravel Sanctum:
import axios from 'axios'
const baseUrl = 'http://yourdomain.com'
const api = axios.create({
baseURL: baseUrl,
withCredentials: true
})
const payload = {}
api().get('/sanctum/csrf-cookie').then(() => {
return api().post('api/like', payload).then(resp => {
// Do stuff with resp
})
})
- [Vuejs]-Clicking non Vuetify button does not update data in v-data-table
- [Vuejs]-Laravel vue stripe: how to pass client_secret PaymentIntent from clientside to serverside?
Source:stackexchange.com