Do funktionierts scho
This commit is contained in:
parent
da018a5c73
commit
3b034edc52
3 changed files with 9 additions and 2 deletions
|
|
@ -73,6 +73,8 @@ export default defineComponent({
|
|||
this.userId = user.id ?? -1;
|
||||
await this.updateUserScores();
|
||||
}
|
||||
let reloadEvent = new Event('reloadLeaderboard');
|
||||
window.dispatchEvent(reloadEvent);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -45,10 +45,14 @@ export default {
|
|||
let body = {
|
||||
score: score,
|
||||
playtime: playTime,
|
||||
date: new Date().toISOString(),
|
||||
date: new Date().toISOString().substring(0, 10),
|
||||
userId: this.userId,
|
||||
}
|
||||
await fetch(Rest.URL + '/game/add', {method: 'POST', body: JSON.stringify(body)});
|
||||
let header = {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
await fetch(Rest.URL + '/game/add', {method: 'POST', body: JSON.stringify(body), headers: header});
|
||||
this.$emit('gameFinished');
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.updatePage();
|
||||
window.addEventListener('reloadLeaderboard', () => {this.updatePage()}, false)
|
||||
},
|
||||
methods: {
|
||||
async fetchPage() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue