load moar matches and save-scroll-state for player

This commit is contained in:
2021-11-15 22:25:34 +01:00
parent 2fc87ab4d8
commit 7130c13ac4
6 changed files with 90 additions and 14 deletions

View File

@@ -129,3 +129,16 @@ export const GetWeaponDmg = async (match_id) => {
console.log(e)
}
}
export const LoadMoreMatchesExplore = async (date) => {
try {
const res = await axios.get(`${API_URL}/matches/next/${date}`)
if (res.status === 200) {
return res.data
}
} catch (err) {
// TODO: 400, 404
console.log(err.response.status, err.response.statusText)
}
}

View File

@@ -93,3 +93,11 @@ export const CreatePlayersArray = (stats) => {
}
return arr
}
export const scrollToPos = (pos = 0) => {
window.scrollTo({
top: pos,
left: 0,
behavior: 'smooth'
})
}

View File

@@ -1,20 +1,38 @@
import {FormatDate, FormatDuration, FormatFullDate, FormatFullDuration, FormatVacDate, MatchNotParsedTime} from "./DateTime";
import {
FormatDate,
FormatDuration,
FormatFullDate,
FormatFullDuration,
FormatVacDate,
MatchNotParsedTime
} from "./DateTime";
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, GetMatches} from "./ApiRequests";
import {
GetMatchDetails,
GetMatches,
GetPlayerMeta,
GetPlayerValue,
GetUser,
GetWeaponDmg,
LoadMoreMatches,
LoadMoreMatchesExplore,
TrackMe
} from "./ApiRequests";
import {
checkStatEmpty,
closeNav,
constructAvatarUrl,
CreatePlayersArray,
FixMapName,
getPlayerArr,
GetWinLoss,
setTitle,
truncate,
sortObjectValue,
CreatePlayersArray
truncate,
scrollToPos
} from "./Utils";
export {
@@ -48,5 +66,7 @@ export {
sortObjectValue,
GetWeaponDmg,
CreatePlayersArray,
GetMatches
GetMatches,
LoadMoreMatchesExplore,
scrollToPos
}