fixed title showing internal bsp name instead of actual map name + added reset-mutations to store

This commit is contained in:
cnachtigall1991
2021-10-19 07:56:37 +02:00
parent 2c25138516
commit bb3da7d3c4
4 changed files with 35 additions and 8 deletions

View File

@@ -1,3 +1,19 @@
export const MAPNAMES = {
'cs_agency': 'Agency',
'cs_insetion2': 'Insertion II',
'cs_office': 'Office',
'de_ancient': 'Ancient',
'de_basalt': 'Basalt',
'de_cache': 'Cache',
'de_dust2': 'Dust II',
'de_inferno': 'Inferno',
'de_mirage': 'Mirage',
'de_nuke': 'Nuke',
'de_overpass': 'Overpass',
'de_train': 'Train',
'de_vertigo': 'Vertigo',
}
export const HITGROUPS = { export const HITGROUPS = {
0: 'HitGroupGeneric', 0: 'HitGroupGeneric',
1: 'HitGroupHead', 1: 'HitGroupHead',

View File

@@ -20,6 +20,18 @@ export default createStore({
changePlayerDetails(state, payload) { changePlayerDetails(state, payload) {
state.playerDetails = payload.data state.playerDetails = payload.data
}, },
resetId64(state) {
state.id64 = ''
},
resetVanityUrl(state) {
state.vanityUrl = ''
},
resetMatchDetails(state) {
state.matchDetails = ''
},
resetPlayerDetails(state) {
state.playerDetails = ''
},
}, },
actions: { actions: {
}, },

View File

@@ -90,6 +90,7 @@ import axios from 'axios'
import {DisplayRank, FormatFullDate, GetAvgRank, GoToLink, LoadImage} from "../utils"; import {DisplayRank, FormatFullDate, GetAvgRank, GoToLink, LoadImage} from "../utils";
import {useStore} from "vuex"; import {useStore} from "vuex";
import {useRoute} from 'vue-router' import {useRoute} from 'vue-router'
import {MAPNAMES} from "../constants";
export default { export default {
name: 'Match', name: 'Match',
@@ -102,7 +103,7 @@ export default {
// Refs // Refs
const data = reactive({ const data = reactive({
playerName: '', player_id: '',
matchDetails: {}, matchDetails: {},
stats: [], stats: [],
score: [0], score: [0],
@@ -116,7 +117,7 @@ export default {
.get(`${process.env.VUE_APP_API_URL}/match/${props.match_id}`) .get(`${process.env.VUE_APP_API_URL}/match/${props.match_id}`)
.then((response) => { .then((response) => {
if (response.data.map) if (response.data.map)
document.title = `${response.data.map} | csgoWTF` document.title = `${MAPNAMES[response.data.map]} | csgoWTF`
else else
document.title = `Match-Details | csgoWTF` document.title = `Match-Details | csgoWTF`
@@ -177,10 +178,7 @@ export default {
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
store.commit({ store.commit('resetMatchDetails')
type: 'changeMatchDetails',
data: {}
})
}) })
return { return {

View File

@@ -378,9 +378,10 @@ export default {
onBeforeUnmount(() => { onBeforeUnmount(() => {
store.commit({ store.commit({
type: 'changePlayerDetails', type: 'changeId64',
data: {} data: store.state.playerDetails.steamid64
}) })
store.commit('resetPlayerDetails')
}) })
return { return {