#7 added errorPages
All checks were successful
CSGOWTF/csgowtf/pipeline/head This commit looks good

This commit is contained in:
2021-11-23 10:33:24 +01:00
parent 21bf749556
commit 44d6a97fb4
12 changed files with 151 additions and 83 deletions

View File

@@ -57,7 +57,7 @@
<div v-if="data.matchDetails.parsed && data.matchDetails.replay_url" class="btn-group">
<i id="downloadMenuBtn" aria-hidden="true" class="fa fa-ellipsis-h mx-2"
@click.prevent="handleDownloadMenu" title="Click for more"></i>
title="Click for more" @click.prevent="handleDownloadMenu"></i>
<div id="downloadGroup" class="group">
<a v-if="data.matchDetails.replay_url" :href="data.matchDetails.replay_url" target="_blank"
title="Download Demo">
@@ -128,13 +128,14 @@ import {onBeforeMount, onBeforeUnmount, onMounted, reactive, watch} from "vue";
import {
closeNav,
CreatePlayersArray,
DisplayRank,
DisplayRank, errorHandling,
FixMapName,
FormatDuration,
FormatFullDate,
GetMatchDetails,
GoToLink,
LoadImage, ProcessName
LoadImage,
ProcessName
} from "../utils";
import {useStore} from "vuex";
import {useRoute} from 'vue-router'
@@ -163,36 +164,37 @@ export default {
if (matchIdPattern.test(props.match_id)) {
const res = await GetMatchDetails(props.match_id)
if (res.map)
document.title = `${FixMapName(res.map)}${res.score[0]} : ${res.score[1]}${DateTime.fromSeconds(res.date).toLocaleString(DateTime.DATETIME_SHORT)} | csgoWTF`
else
document.title = `Match-Details | csgoWTF`
if (res) {
if (res.map)
document.title = `${FixMapName(res.map)}${res.score[0]} : ${res.score[1]}${DateTime.fromSeconds(res.date).toLocaleString(DateTime.DATETIME_SHORT)} | csgoWTF`
else
document.title = `Match-Details | csgoWTF`
store.commit({
type: 'changeMatchDetails',
data: res
})
store.commit({
type: 'changeMatchDetails',
data: res
})
data.matchDetails = store.state.matchDetails
data.matchDetails = store.state.matchDetails
data.matchDetails.stats.forEach(p => {
p.player.name = ProcessName(p.player.name)
})
data.matchDetails.stats.forEach(p => {
p.player.name = ProcessName(p.player.name)
})
data.stats = data.matchDetails.stats
data.score = data.matchDetails.score
data.stats = data.matchDetails.stats
data.score = data.matchDetails.score
LoadImage(data.matchDetails.map ? data.matchDetails.map : 'random')
LoadImage(data.matchDetails.map ? data.matchDetails.map : 'random')
store.commit({
type: 'changePlayesArr',
data: CreatePlayersArray(data.stats)
})
store.commit({
type: 'changePlayesArr',
data: CreatePlayersArray(data.stats)
})
console.log(data.matchDetails)
console.log(data.matchDetails)
}
} else {
console.log('Match not found')
// TODO: needs 404
errorHandling(404)
}
}
@@ -202,15 +204,13 @@ export default {
if (matchIdPattern.test(props.match_id))
GoToLink(`/match/${props.match_id}/${sub}`)
else {
console.log('Match not found')
// TODO: needs 404
errorHandling(404)
}
} else if (route.fullPath.split('/')[3] === undefined) {
if (matchIdPattern.test(props.match_id))
GoToLink(`/match/${props.match_id}/overview`)
else {
console.log('Match not found')
// TODO: needs 404
errorHandling(404)
}
}
}