send client id header with every request initiated from frontend to backend

This commit is contained in:
Zutatensuppe 2021-07-11 17:48:49 +02:00
parent e7628895c9
commit 8f31a669d5
6 changed files with 28 additions and 17 deletions

View file

@ -13,6 +13,7 @@
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import xhr from '../xhr'
import GameTeaser from './../components/GameTeaser.vue'
@ -27,7 +28,7 @@ export default defineComponent({
}
},
async created() {
const res = await fetch('/api/index-data')
const res = await xhr.get('/api/index-data', {})
const json = await res.json()
this.gamesRunning = json.gamesRunning
this.gamesFinished = json.gamesFinished

View file

@ -133,7 +133,7 @@ export default defineComponent({
this.filtersChanged()
},
async loadImages () {
const res = await fetch(`/api/newgame-data${Util.asQueryArgs(this.filters)}`)
const res = await xhr.get(`/api/newgame-data${Util.asQueryArgs(this.filters)}`, {})
const json = await res.json()
this.images = json.images
this.tags = json.tags
@ -165,8 +165,7 @@ export default defineComponent({
return await res.json()
},
async saveImage (data: any) {
const res = await fetch('/api/save-image', {
method: 'post',
const res = await xhr.post('/api/save-image', {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
@ -200,8 +199,7 @@ export default defineComponent({
this.dialog = 'new-game'
},
async onNewGame(gameSettings: GameSettings) {
const res = await fetch('/api/newgame', {
method: 'post',
const res = await xhr.post('/api/newgame', {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'