new feature "Explore Site"

This commit is contained in:
2021-11-15 19:27:10 +01:00
parent e169d4d80b
commit 2fc87ab4d8
9 changed files with 543 additions and 425 deletions

View File

@@ -2,6 +2,17 @@ import axios from "axios";
const API_URL = process.env.VUE_APP_API_URL
export const GetMatches = async () => {
try {
const res = await axios.get(`${API_URL}/matches`)
if (res.status === 200)
return res.data
} catch (err) {
// TODO: Error handling
console.log(err.response.status, err.response.statusText)
}
}
export const GetUser = async (id) => {
try {

View File

@@ -67,20 +67,6 @@ export const constructAvatarUrl = (hash, size) => {
}
}
export const GetAvgRank = (stats) => {
let count = 0
let fullRank = 0
stats.map(player => {
if (player.rank?.old) {
fullRank += player.rank?.old
count += 1
}
})
return count === 0 ? 0 : Math.floor(fullRank / count)
}
export const sortObjectValue = (obj, direction = 'asc') => {
const sortable = []
for (let key in obj) {

View File

@@ -3,13 +3,12 @@ import {GoToLink, GoToMatch, GoToPlayer} from "./GoTo";
import {SaveLastVisitedToLocalStorage} from "./LocalStorage";
import {GetHLTV_1} from "./HLTV";
import {DisplayRank, LoadImage} from "./Display";
import {GetMatchDetails, GetPlayerMeta, GetPlayerValue, GetUser, LoadMoreMatches, TrackMe, GetWeaponDmg} from "./ApiRequests";
import {GetMatchDetails, GetPlayerMeta, GetPlayerValue, GetUser, LoadMoreMatches, TrackMe, GetWeaponDmg, GetMatches} from "./ApiRequests";
import {
checkStatEmpty,
closeNav,
constructAvatarUrl,
FixMapName,
GetAvgRank,
getPlayerArr,
GetWinLoss,
setTitle,
@@ -44,10 +43,10 @@ export {
checkStatEmpty,
getPlayerArr,
constructAvatarUrl,
GetAvgRank,
FixMapName,
closeNav,
sortObjectValue,
GetWeaponDmg,
CreatePlayersArray
CreatePlayersArray,
GetMatches
}