I'm new to Vuejs 2 and currently doing a project. I'm using vuetable-2 to form a datatable in Vuejs 2.
I'm currently facing a problem by which I'm unable to retrieve data using the property, api-url, vuetable-2.
However, I'm able to retrieve data from server by using Axios and the Global Axios Default Configs (to pass the token into every request headers).
This image above shows 2 sections:
1. Using vuetable-2's api-url [The one with Error 403, Forbidden]
2. Using Axios GET request [Successfully retrieve data]
Vuetable-2 api-url (api call to server):
<vuetable
ref="vuetable"
api-url="http://localhost:3000/api/staffs"
:http-options = "httpOptions"
:load-on-start = "loadOnStart"
:fields="['userId', 'name', 'username']"
></vuetable>
Axios's Global Default Configuration:
// Global axios default (config default that will be applied to every request)
var accessToken = window.localStorage.getItem('access_token')
axios.defaults.baseURL = 'http://localhost:3000/'
axios.defaults.headers.common['x-access-token'] = accessToken
Am I missing out on anything? :-/