fix: load previous state with correct team
This commit is contained in:
@@ -96,16 +96,20 @@ function ChemistryDnD({ user, teams, players }: PlayerInfoProps) {
|
||||
}
|
||||
|
||||
async function handleGet() {
|
||||
const chemistry = (await apiAuth("chemistry", null, "GET")) as Chemistry;
|
||||
setPlayersLeft(filterSort(otherPlayers, chemistry.hate));
|
||||
setPlayersMiddle(
|
||||
otherPlayers.filter(
|
||||
(player) =>
|
||||
!chemistry.hate.includes(player.id) &&
|
||||
!chemistry.love.includes(player.id)
|
||||
)
|
||||
);
|
||||
setPlayersRight(filterSort(otherPlayers, chemistry.love));
|
||||
const data = await apiAuth(`chemistry/${teams.activeTeam}`, null, "GET");
|
||||
if (data.detail) alert(data.detail);
|
||||
else {
|
||||
const chemistry = data as Chemistry;
|
||||
setPlayersLeft(filterSort(otherPlayers, chemistry.hate));
|
||||
setPlayersMiddle(
|
||||
otherPlayers.filter(
|
||||
(player) =>
|
||||
!chemistry.hate.includes(player.id) &&
|
||||
!chemistry.love.includes(player.id)
|
||||
)
|
||||
);
|
||||
setPlayersRight(filterSort(otherPlayers, chemistry.love));
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -201,9 +205,15 @@ function MVPDnD({ user, teams, players }: PlayerInfoProps) {
|
||||
}
|
||||
|
||||
async function handleGet() {
|
||||
const mvps = (await apiAuth("mvps", null, "GET")) as MVPRanking;
|
||||
setRankedPlayers(filterSort(players, mvps.mvps));
|
||||
setAvailablePlayers(players.filter((user) => !mvps.mvps.includes(user.id)));
|
||||
const data = await apiAuth(`mvps/${teams.activeTeam}`, null, "GET");
|
||||
if (data.detail) alert(data.detail);
|
||||
else {
|
||||
const mvps = data as MVPRanking;
|
||||
setRankedPlayers(filterSort(players, mvps.mvps));
|
||||
setAvailablePlayers(
|
||||
players.filter((user) => !mvps.mvps.includes(user.id))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user