mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 17:29:17 +02:00
Revert "Merge branch '629-cookie-auth' into 'develop'"
This reverts commit8b47af8b81
, reversing changes made toc0055b3b20
.
This commit is contained in:
parent
666409dce0
commit
b9f0c6aecd
18 changed files with 153 additions and 203 deletions
|
@ -16,7 +16,6 @@ import GetTextPlugin from 'vue-gettext'
|
|||
import { sync } from 'vuex-router-sync'
|
||||
import locales from '@/locales'
|
||||
|
||||
import cookie from '@/utils/cookie'
|
||||
import filters from '@/filters' // eslint-disable-line
|
||||
import globals from '@/components/globals' // eslint-disable-line
|
||||
|
||||
|
@ -71,9 +70,8 @@ Vue.directive('title', function (el, binding) {
|
|||
)
|
||||
axios.interceptors.request.use(function (config) {
|
||||
// Do something before request is sent
|
||||
let csrfToken = cookie.get('csrftoken')
|
||||
if (csrfToken) {
|
||||
config.headers['X-CSRFToken'] = csrfToken
|
||||
if (store.state.auth.token) {
|
||||
config.headers['Authorization'] = store.getters['auth/header']
|
||||
}
|
||||
return config
|
||||
}, function (error) {
|
||||
|
@ -87,14 +85,9 @@ axios.interceptors.response.use(function (response) {
|
|||
}, function (error) {
|
||||
error.backendErrors = []
|
||||
if (error.response.status === 401) {
|
||||
if (error.response.config.skipLoginRedirect) {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
store.commit('auth/authenticated', false)
|
||||
if (router.currentRoute.name !== 'login') {
|
||||
logger.default.warn('Received 401 response from API, redirecting to login form', router.currentRoute.fullPath)
|
||||
router.push({name: 'login', query: {next: router.currentRoute.fullPath}})
|
||||
}
|
||||
logger.default.warn('Received 401 response from API, redirecting to login form', router.currentRoute.fullPath)
|
||||
router.push({name: 'login', query: {next: router.currentRoute.fullPath}})
|
||||
}
|
||||
if (error.response.status === 404) {
|
||||
error.backendErrors.push('Resource not found')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue