fixed broken elements due to api changes

This commit is contained in:
cnachtigall1991
2021-10-17 19:52:12 +02:00
parent 123f78cb21
commit 6310295795
10 changed files with 228 additions and 69 deletions

View File

@@ -10,7 +10,7 @@ export const GetUser = async (id) => {
if (res.status === 200)
return [res.status, res.data]
} catch (err) {
if (err.response.status === 404)
if (err.response)
return [err.response.status, err.response.statusText]
}
}
@@ -35,7 +35,7 @@ export const TrackMe = async (id64, authcode, sharecode) => {
try {
const res = await axios
.post(`${API_URL}/player/trackme`, `id=${id64}&authcode=${authcode}&sharecode=${sharecode}`)
.post(`${API_URL}/player/${id64}/track`, `authcode=${authcode}&sharecode=${sharecode}`)
if (res.status === 202) {
status = res.status

View File

@@ -48,9 +48,12 @@ export const getPlayerArr = (stats, team, color) => {
export const constructAvatarUrl = (hash, size) => {
const base = 'https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars'
const imgSize = size ? `_${size}` : ''
const hashDir = hash.substring(0, 2)
return `${base}/${hashDir}/${hash}${imgSize}.jpg`
if (hash) {
const hashDir = hash.substring(0, 2)
return `${base}/${hashDir}/${hash}${imgSize}.jpg`
}
}
export const GetAvgRank = (stats) => {