fix CORS and CSP

This commit is contained in:
Jonas Heinrich 2020-11-22 16:17:48 +01:00
parent 1b23c68948
commit 577f88c398
3 changed files with 8 additions and 0 deletions

View File

@ -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 => {

View File

@ -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 => {

View File

@ -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 => {