Estoy tratando de configurar vue-auth en mi aplicación laravel-vue. Pero recibo errores de consola como
Error (@websanova/vue-auth): drivers/http/axios.js: el complemento http no se ha configurado.
TypeError no detectado: this.plugins.http no está definido
y este es el contenido de mi archivo app.js
import 'core-js/stable' import Vue from 'vue' import App from './App.vue' import router from './router' import VueAxios from 'vue-axios' import CoreuiVue from '@coreui/vue' import { iconsSet as icons } from './assets/icons/icons.js' import store from './store' import VueAuth from '@websanova/vue-auth/dist/v2/vue-auth.esm.js'; import auth from './auth'; Vue.prototype.$apiAdress = 'http://127.0.0.1:8000' Vue.config.performance = true Vue.use(CoreuiVue) Vue.use(VueAuth,auth) new Vue({ el: '#app', router, store, icons, template: '<App/>', components: { App }, })y contenido auth.js
import Vue from 'vue' import bearer from '@websanova/vue-auth/dist/drivers/auth/bearer.esm' import axios from '@websanova/vue-auth/dist/drivers/http/axios.1.x.esm'; import router from '@websanova/vue-auth/dist/drivers/router/vue-router.2.x.esm'; // Auth base configuration some of this options // can be override in method calls const config = { plugins: { http: Vue.axios, // Axios router: Vue.router, }, drivers: { auth: bearer, http: axios, router: router, tokenDefaultName: 'token', tokenStore: ['localStorage'], rolesVar: 'role', // registerData: {url: 'auth/register', method: 'POST', redirect: '/login'}, loginData: {url: 'login', method: 'POST', redirect: '/dashboard', fetchUser: true}, logoutData: {url: 'logout', method: 'POST', redirect: '/login', makeRequest: true}, fetchData: {url: 'user', method: 'GET', enabled: true}, refreshData: {url: 'refresh', method: 'GET', enabled: true, interval:30 }, authRedirect: { path: '/' }, parseUserData(response){ let data = response.data; data.refresh = response.refresh_token; localStorage.setItem("user", JSON.stringify(data)); return data; } }, options: { rolesKey: 'type', notFoundRedirect: {name: 'user-account'}, } } export default configy seguí este tutorial https://websanova.com/docs/vue-auth/guides/startup para configurar. por favor ayúdame a encontrar lo que estoy haciendo mal. Laravel Framework 8.6.0 y vue": "^2.5.17" .
Gracias por adelantado.
Podría encontrar una solución. Y esto se puede resolver usando las guías de tutorial https://websanova.com/docs/vue-auth/guides/startup .
Después de instalar el complemento websanova/vue-auth, hay algunas dependencias que deben configurarse antes de instalar el complemento.
enrutador
Se debe configurar el Vue.router, que luego corresponde al controlador del enrutador instalado con el complemento.
HTTP
Se debe configurar un complemento http que corresponda al controlador http instalado con el complemento.
así como la configuración.
Git:https://github.com/websanova/vue-auth/tree/master/demos/2.x/src
Configuré la aplicación tal como se configuró en el archivo git main.js.
Y funcionó.