X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=inline;f=resources%2Fjs%2Fpages%2FTournament.js;h=ecaab6c97807bf1968b7e1732cf8c7d624a0a85b;hb=HEAD;hp=5de5dbe32758c1215cc48d30c37db0dea946b79c;hpb=9ac5e263a259207e3ecd132188df41f7c3315b88;p=alttp.git diff --git a/resources/js/pages/Tournament.js b/resources/js/pages/Tournament.js index 5de5dbe..ecaab6c 100644 --- a/resources/js/pages/Tournament.js +++ b/resources/js/pages/Tournament.js @@ -10,6 +10,8 @@ import Loading from '../components/common/Loading'; import NotFound from '../pages/NotFound'; import Detail from '../components/tournament/Detail'; import { + canLoadMoreRounds, + getLastRound, patchApplication, patchParticipant, patchResult, @@ -97,6 +99,21 @@ export const Component = () => { }; }, [id]); + const moreRounds = React.useCallback(async () => { + const last_round = getLastRound(tournament); + if (!last_round) return; + console.log(last_round); + const last_known = last_round.number; + const rsp = await axios.get( + `/api/tournaments/${id}/more-rounds`, + { params: { last_known } }, + ); + setTournament(tournament => ({ + ...tournament, + rounds: [...tournament.rounds, ...rsp.data], + })); + }, [id, tournament]); + useEffect(() => { const cb = (e) => { if (e.user) { @@ -132,6 +149,10 @@ export const Component = () => {