Commit 577f88c3 authored by onny's avatar onny

fix CORS and CSP

parent 1b23c689
Pipeline #221 failed with stages
in 12 minutes and 8 seconds
......@@ -159,6 +159,7 @@ export default {
stationid = this.favorites[i][0]
}
}
axios.defaults.headers.requesttoken = requesttoken
await axios
.delete(generateUrl(`/apps/radio/api/favorites/${stationid}`))
.then(response => {
......
......@@ -7,6 +7,7 @@ import Main from './components/Main'
import store from './store.js'
Vue.use(Router)
const requesttoken = axios.defaults.headers.requesttoken
const router = new Router({
base: generateUrl('/apps/radio/'),
......@@ -52,6 +53,7 @@ router.beforeEach((to, from, next) => {
store.dispatch('setMenuState', to.name)
next()
} else {
axios.defaults.headers.requesttoken = requesttoken
axios
.get(generateUrl('/apps/radio/settings/menuState'))
.then(async response => {
......
......@@ -5,6 +5,7 @@ import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
Vue.use(Vuex)
const requesttoken = axios.defaults.headers.requesttoken
export default new Vuex.Store({
state: {
......@@ -52,11 +53,13 @@ export default new Vuex.Store({
state.player.title = title
},
setMenuState(state, menuState) {
axios.defaults.headers.requesttoken = requesttoken
axios.post(generateUrl('/apps/radio/settings/menuState'), {
menuState,
})
},
getMenuState(state) {
axios.defaults.headers.requesttoken = requesttoken
axios
.get(generateUrl('/apps/radio/settings/menuState'))
.then(async response => {
......@@ -67,11 +70,13 @@ export default new Vuex.Store({
})
},
setVolumeState(state, volumeState) {
axios.defaults.headers.requesttoken = requesttoken
axios.post(generateUrl('/apps/radio/settings/volumeState'), {
volumeState,
})
},
getVolumeState(state) {
axios.defaults.headers.requesttoken = requesttoken
axios
.get(generateUrl('/apps/radio/settings/volumeState'))
.then(async response => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment