diff --git a/src/components/ScoreTeam.vue b/src/components/ScoreTeam.vue
index ff92a70..11bc8e7 100644
--- a/src/components/ScoreTeam.vue
+++ b/src/components/ScoreTeam.vue
@@ -175,7 +175,7 @@ export default {
}
} else if (team === 2) {
arr = []
- for (let i = 5; i < 10; i++) {
+ for (let i = 5; i < store.state.matchDetails.stats.length; i++) {
arr.push(store.state.matchDetails.stats[i])
}
}
diff --git a/src/utils/ApiRequests.js b/src/utils/ApiRequests.js
index 3c6d408..027f8f5 100644
--- a/src/utils/ApiRequests.js
+++ b/src/utils/ApiRequests.js
@@ -2,26 +2,35 @@ import axios from "axios";
import {errorHandling} from "@/utils/Utils";
const API_URL = process.env.VUE_APP_API_URL
+const TIMEOUT = 10_000
export const GetMatches = async () => {
try {
- const res = await axios.get(`${API_URL}/matches`)
+ const res = await axios({
+ method: 'get',
+ url: `${API_URL}/matches`,
+ timeout: TIMEOUT
+ })
if (res.status === 200)
return res.data
- } catch (err) {
- errorHandling(err.response.status)
+ } catch {
+ console.log('Could not load matches')
}
}
export const GetUser = async (id) => {
try {
- const res = await axios.get(`${API_URL}/player/${id}`)
+ const res = await axios({
+ method: 'get',
+ url: `${API_URL}/player/${id}`,
+ timeout: TIMEOUT
+ })
if (res.status === 200)
return res.data
- } catch (err) {
- errorHandling(err.response.status)
+ } catch {
+ console.log('Could not load user')
}
}
@@ -44,8 +53,15 @@ export const TrackMe = async (id64, authcode, sharecode = '') => {
}
try {
- const res = await axios
- .post(`${API_URL}/player/${id64}/track`, `authcode=${authcode}&sharecode=${sharecode}`)
+ // const res = await axios
+ // .post(`${API_URL}/player/${id64}/track`, `authcode=${authcode}&sharecode=${sharecode}`)
+
+ const res = await axios({
+ method: 'post',
+ url: `${API_URL}/player/${id64}/track`,
+ data: `authcode=${authcode}&sharecode=${sharecode}`,
+ timeout: TIMEOUT
+ })
if (res.status === 202) {
status = res.status
@@ -67,73 +83,96 @@ export const TrackMe = async (id64, authcode, sharecode = '') => {
export const GetPlayerValue = async (match_id) => {
try {
- const res = await axios.get(`${API_URL}/match/${match_id}/rounds`)
+ const res = await axios({
+ method: 'get',
+ url: `${API_URL}/match/${match_id}/rounds`,
+ timeout: TIMEOUT
+ })
if (res.status === 200) {
return res.data
}
- } catch (err) {
- errorHandling(err.response.status)
+ } catch {
+ console.log('Could not get player value')
}
}
export const GetMatchDetails = async (match_id) => {
try {
- const res = await axios.get(`${API_URL}/match/${match_id}`)
+ const res = await axios({
+ method: 'get',
+ url: `${API_URL}/match/${match_id}`,
+ timeout: TIMEOUT
+ })
if (res.status === 200) {
return res.data
}
- } catch (err) {
- errorHandling(err.response.status)
+ } catch {
+ console.log('Could not load match details')
}
}
export const LoadMoreMatches = async (player_id, date) => {
try {
- const res = await axios.get(`${API_URL}/player/${player_id}/next/${date}`)
+ const res = await axios({
+ method: 'get',
+ url: `${API_URL}/player/${player_id}/next/${date}`,
+ timeout: TIMEOUT
+ })
if (res.status === 200) {
return res.data
}
- } catch (err) {
- errorHandling(err.response.status)
+ } catch {
+ console.log('Could not load more matches')
}
}
export const GetPlayerMeta = async (player_id, limit = 4) => {
try {
- const res = await axios.get(`${API_URL}/player/${player_id}/meta/${limit}`)
+ const res = await axios({
+ method: 'get',
+ url: `${API_URL}/player/${player_id}/meta/${limit}`,
+ timeout: TIMEOUT
+ })
if (res.status === 200) {
- // console.log(res.data)
return res.data
}
- } catch (err) {
- errorHandling(err.response.status)
+ } catch {
+ console.log('Could not load player metadata')
}
}
export const GetWeaponDmg = async (match_id) => {
try {
- const res = await axios.get(`${API_URL}/match/${match_id}/weapons`)
+ const res = await axios({
+ method: 'get',
+ url: `${API_URL}/match/${match_id}/weapons`,
+ timeout: TIMEOUT
+ })
if (res.status === 200) {
return res.data
}
- } catch (err) {
- errorHandling(err.response.status)
+ } catch {
+ console.log('Could not calculate weapon damage')
}
}
export const LoadMoreMatchesExplore = async (date) => {
try {
- const res = await axios.get(`${API_URL}/matches/next/${date}`)
+ const res = await axios({
+ method: 'get',
+ url: `${API_URL}/matches/next/${date}`,
+ timeout: TIMEOUT
+ })
if (res.status === 200) {
return res.data
}
- } catch (err) {
- errorHandling(err.response.status)
+ } catch {
+ console.log('Could not load more matches')
}
}
diff --git a/src/views/Explore.vue b/src/views/Explore.vue
index 87f2559..5b207e9 100644
--- a/src/views/Explore.vue
+++ b/src/views/Explore.vue
@@ -4,12 +4,20 @@
Recent matches
-
+
+
-
-
+
+
+
+
+
+
+
+ There seems to be a problem loading the content
+ Please try again later
@@ -47,17 +55,21 @@ export default {
onMounted(async () => {
data.matches = await GetMatches()
- if (data.matches[0].map) {
- await LoadImage(data.matches[0].map)
- } else if (!data.matches[0].map && MatchNotParsedTime(data.matches[0].date) && data.matches[1].map) {
- await LoadImage(data.matches[1].map)
- } else {
- await LoadImage('random')
+ if (data.matches) {
+ if (data.matches[0].map) {
+ await LoadImage(data.matches[0].map)
+ } else if (!data.matches[0].map && MatchNotParsedTime(data.matches[0].date) && data.matches[1].map) {
+ await LoadImage(data.matches[1].map)
+ } else {
+ await LoadImage('random')
+ }
}
scrollToPos(store.state.scroll_state)
- console.log(data.matches)
+ if (data.matches) {
+ console.log(data.matches)
+ }
})
onBeforeUnmount(() => {
diff --git a/src/views/Player.vue b/src/views/Player.vue
index acfd74a..8a0930f 100644
--- a/src/views/Player.vue
+++ b/src/views/Player.vue
@@ -3,136 +3,145 @@
-
-
-
-
![Player avatar]()
-
-
-
-
-
-
- Wins |
- Losses |
- Ties |
- Win-Rate |
- Tie-Rate |
-
-
- {{ data.match_stats.win }} |
- {{ data.match_stats.loss }} |
- {{ data.match_stats.tie }} |
- {{
- data.match_stats.win > 0 ? (data.match_stats.win / data.match_stats.total * 100).toFixed(0) : 0
- }}%
- |
- {{
- data.match_stats.tie > 0 ? (data.match_stats.tie / data.match_stats.total * 100).toFixed(0) : 0
- }}%
- |
-
-
-
-

-

-
+
+
+
+
+
-
-
-
- {{ data.statusError }}
+
+
+
+
+
+ Wins |
+ Losses |
+ Ties |
+ Win-Rate |
+ Tie-Rate |
+
+
+ {{ data.match_stats.win }} |
+ {{ data.match_stats.loss }} |
+ {{ data.match_stats.tie }} |
+ {{
+ data.match_stats.win > 0 ? (data.match_stats.win / data.match_stats.total * 100).toFixed(0) : 0
+ }}%
+ |
+ {{
+ data.match_stats.tie > 0 ? (data.match_stats.tie / data.match_stats.total * 100).toFixed(0) : 0
+ }}%
+ |
+
+
+
+

+

+
-
- {{ data.statusError }}
-
-
- {{ data.statusError }}
-
-
-
-
-
-
-
+
+
-
-
No matches on record
+
+ No matches on record
+
+
+
-
-
-
-
+
+
+
Player-Page
+
+ There seems to be a problem loading the player
+ Please try again later
@@ -153,11 +162,11 @@ import {
LoadImage,
LoadMoreMatches,
MatchNotParsedTime,
+ ProcessName,
SaveLastVisitedToLocalStorage,
scrollToPos,
setTitle,
- TrackMe,
- ProcessName
+ TrackMe
} from "../utils";
import {FOOTER_HEIGHT, NAV_HEIGHT} from "@/constants";
import MatchesTable from "@/components/MatchesTable";
@@ -459,6 +468,7 @@ export default {
.matches {
width: 75%;
}
+
.side-info-container {
width: 25%;
}