websanova / vue-auth

A simple light-weight authentication library for Vue.js
MIT License
2.36k stars 380 forks source link

Influence of router base attribute on base api url #668

Closed klima7 closed 2 years ago

klima7 commented 2 years ago

I have frontend deployed on github pages with router working in history mode. In this configuration it is required for router to have base parameter, bacause frontend is available under https://klima7.github.io/repo-name

Vue.router = new VueRouter({
  mode: "history",
  base: '/repo-name/',
  routes
})

And my axios is configured in this way axios.defaults.baseURL = "https://api.backend.com"

Now when I'm performing for example auth.login operation with vue-auth the request is sent to https://api.backend.com/repo-name/auth/login instead of https://api.backend.com/auth/login, what I want.

When I'm using axios outside vue-auth requests are sent normally to https://api.backend.com, so I don't understand why vue-auth is adding this strange /repo-name/ part.

Is there any way to get rid of this /repo-name/ part in auth requests? Maybe I don't understand something.