Попробуйте использовать this
вместо Vue
и попробуйте ax ios:
async getAllStudents({commit}) {
await this.$axios.get(`/api/students`)
.then((res) => {
if (res.status === 200) {
commit('setAllStudents', res.data)
}
}).catch(function(error) {
console.log(error);
});
},
убедитесь, что ваш nuxt.config.js
выглядит так:
const routerBase = process.env.DEPLOY_ENV === 'GH_PAGES' ? {
router: {
base: '/boussadjra-brahim/'
}
} : {}
export default {
mode: 'universal',
/*
** Headers of the page
*/
head: {
titleTemplate: '%s - ' + 'Boussadjra Brahim',
title: 'Boussadjra Brahim' || '',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
],
},
/*
** Plugins to load before mounting the App
*/
plugins: [
],
....
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
],
....
}