forked from CSGOWTF/csgowtf
new feature "Explore Site"
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user