Skip to content

Commit

Permalink
refactor(games): load refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
garrappachc committed Mar 3, 2024
1 parent fb1ae49 commit 48cb98c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/routes/games/[id=number]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ export const load = (async ({ params, fetch, parent }) => {
if (['created', 'configuring', 'launching', 'started'].includes(game.state)) {
const { profile } = await parent();

if (
profile &&
['active', 'waiting for substitute'].includes(
game.slots.find(slot => slot.player.id === profile.player.id)?.status ?? '',
)
) {
const mySlot = game.slots.find(slot => slot.player.id === profile.player.id);
if (mySlot && ['active', 'waiting for substitute'].includes(mySlot.status)) {
// I'm a member of this game
isMyGame = true;
connectInfo = await fetchConnectInfo(params.id, fetch);
Expand Down

0 comments on commit 48cb98c

Please sign in to comment.