+export const LoadMoreMatchesExplore = async (store, date) => {
let response = null
await axios
@@ -293,16 +525,34 @@ export const LoadMoreMatchesExplore = async (date) => {
.catch((err) => {
switch (err.response.status) {
case STATUS.BAD_REQUEST:
- // TODO: ERROR
- console.log('GetMatches - bad request')
+ store.commit({
+ type: 'changeInfoState',
+ data: {
+ statuscode: STATUS.BAD_REQUEST,
+ message: 'Bad request',
+ type: 'error'
+ }
+ })
break
case STATUS.INTERNAL_SERVER_ERROR:
- // TODO: ERROR
- console.log('GetMatches - internal server error')
+ store.commit({
+ type: 'changeInfoState',
+ data: {
+ statuscode: STATUS.INTERNAL_SERVER_ERROR,
+ message: 'Unable to load more matches',
+ type: 'error'
+ }
+ })
break
default:
- // TODO: ERROR
- console.log('GetMatches - default error')
+ store.commit({
+ type: 'changeInfoState',
+ data: {
+ statuscode: err.response.status,
+ message: 'An unknown error occured',
+ type: 'error'
+ }
+ })
}
})
diff --git a/src/views/Explore.vue b/src/views/Explore.vue
index f26daf9..38fa989 100644
--- a/src/views/Explore.vue
+++ b/src/views/Explore.vue
@@ -43,7 +43,7 @@ export default {
})
const setMoreMatches = async () => {
- const res = await LoadMoreMatchesExplore(data.matches[data.matches.length - 1].date)
+ const res = await LoadMoreMatchesExplore(store, data.matches[data.matches.length - 1].date)
res.forEach(e => data.matches.push(e))
@@ -53,7 +53,7 @@ export default {
}
onMounted(async () => {
- data.matches = await GetMatches()
+ data.matches = await GetMatches(store)
if (data.matches) {
if (data.matches[0].map) {
diff --git a/src/views/Match.vue b/src/views/Match.vue
index 160fe06..bb8ffd5 100644
--- a/src/views/Match.vue
+++ b/src/views/Match.vue
@@ -194,7 +194,7 @@ export default {
// Functions
const GetMatch = async () => {
if (matchIdPattern.test(props.match_id)) {
- const res = await GetMatchDetails(props.match_id)
+ const res = await GetMatchDetails(store, props.match_id)
if (res) {
if (res.map)
@@ -234,7 +234,7 @@ export default {
LoadImage(data.matchDetails.map ? data.matchDetails.map : 'random')
store.commit({
- type: 'changePlayesArr',
+ type: 'changePlayersArr',
data: CreatePlayersArray(data.stats)
})
diff --git a/src/views/Player.vue b/src/views/Player.vue
index 253b941..f88ffa1 100644
--- a/src/views/Player.vue
+++ b/src/views/Player.vue
@@ -68,17 +68,6 @@
>
Track Me!
-
- {{ data.statusError }}
-
-
- {{ data.statusError }}
-
-
- {{ data.statusError }}
-