single API requests before recieving the data

This commit is contained in:
2023-04-28 16:18:52 +02:00
parent 0be6adb7d2
commit dd075d2982
5 changed files with 80 additions and 63 deletions
+2 -2
View File
@@ -179,8 +179,8 @@ export default defineComponent({
}
},
players (): { [key: string]: Player } {
const data = this.store.getPlayerList(this.filters || {})?.data
if (!data) return {}
const data = this.store.getPlayerList(this.filters || {})?.value.data
if (!data) return this.store.fetchPlayers(this.filters || {}).value.data
const cut = Object.entries(data).sort((a, b) => {
if (a[1].kills < b[1].kills) {
return 1
+3 -1
View File
@@ -46,7 +46,9 @@ export default defineComponent({
computed: {
players (): { [key: string]: Player } {
const { player: _, ...withoutPlayer } = this.filters
return this.store.getPlayerList(withoutPlayer)?.data || {}
const data = this.store.getPlayerList(withoutPlayer)?.value.data
if (!data) return this.store.fetchPlayers(withoutPlayer).value.data
return data
}
},
watch: {
+2 -5
View File
@@ -137,11 +137,8 @@ export default defineComponent({
},
weapons (): { [key: string]: Weapon } {
const { weapon: _, ...withoutWeapon } = this.filters || {}
const data = this.store.getWeaponList(withoutWeapon)?.data
if (!data) {
this.store.fetchWeapons(withoutWeapon)
return {}
}
const data = this.store.getWeaponList(withoutWeapon)?.value.data
if (!data) return this.store.fetchWeapons(withoutWeapon).value.data
return data
},
sortedWeaponList (): string[] {