updated DetailsComponent.vue

This commit is contained in:
2022-03-25 16:22:01 +01:00
parent 9cbbfe9393
commit 1236c2ca2d

View File

@@ -12,39 +12,33 @@
</div> </div>
</template> </template>
<script> <script setup lang="ts">
import MultiKillsChart from "/src/components/MultiKillsChart"; import MultiKillsChart from "@/components/MultiKillsChart.vue";
import { useStore } from "vuex"; import { onMounted } from "vue";
import { onMounted, reactive } from "vue"; import { GetWeaponDmg } from "@/utils";
import { GetWeaponDmg } from "/src/utils"; import { useMatchDetailsStore } from "@/stores/matchDetails";
import { useInfoStateStore } from "@/stores/infoState";
import type { MatchWeapons } from "@/types";
export default { const matchDetailsStore = useMatchDetailsStore();
name: "DetailsComponent", const infoStateStore = useInfoStateStore();
components: { MultiKillsChart },
setup() {
const store = useStore();
const data = reactive({ const data = {} as MatchWeapons;
spray: [],
});
const getWeaponDamage = async () => { const getWeaponDamage = async () => {
const resData = await GetWeaponDmg( const [resData, info] = await GetWeaponDmg(
store, matchDetailsStore.matchDetails.match_id
store.state.matchDetails.match_id );
);
if (resData !== null) {
data.spray = resData.spray;
}
};
onMounted(() => { if (info.message !== "") infoStateStore.addInfo(info);
getWeaponDamage(); if (resData !== null) {
}); data.spray = resData.spray;
}
return { data };
},
}; };
onMounted(() => {
getWeaponDamage();
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>