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