Fix round order (#119)

This commit is contained in:
Erik Vroon
2023-02-21 00:01:48 +01:00
committed by GitHub
parent e4fd83c3bc
commit 45cd04137f
3 changed files with 18 additions and 16 deletions

View File

@@ -51,7 +51,7 @@ class UvicornTestServer(uvicorn.Server):
async def startup(self, sockets: Optional[Sequence[socket.socket]] = None) -> None:
sockets_list = list(sockets) if sockets is not None else sockets
await super().startup(sockets=sockets_list)
await super().startup(sockets=sockets_list) # type: ignore[arg-type]
self.config.setup_event_loop()
self._startup_done.set()

View File

@@ -32,17 +32,19 @@ export default function Brackets({
);
}
const rounds = swrRoundsResponse.data.data.map((round: RoundInterface) => (
<Grid.Col sm={6} lg={4} xl={3} key={round.id}>
<Round
tournamentData={tournamentData}
round={round}
swrRoundsResponse={swrRoundsResponse}
swrUpcomingMatchesResponse={swrUpcomingMatchesResponse}
readOnly={readOnly}
/>
</Grid.Col>
));
const rounds = swrRoundsResponse.data.data
.sort((r1: any, r2: any) => (r1.name > r2.name ? 1 : 0))
.map((round: RoundInterface) => (
<Grid.Col sm={6} lg={4} xl={3} key={round.id}>
<Round
tournamentData={tournamentData}
round={round}
swrRoundsResponse={swrRoundsResponse}
swrUpcomingMatchesResponse={swrUpcomingMatchesResponse}
readOnly={readOnly}
/>
</Grid.Col>
));
return <Grid>{rounds}</Grid>;
}

View File

@@ -6,17 +6,17 @@ export async function performLogin(username: string, password: string) {
bodyFormData.append('username', username);
bodyFormData.append('password', password);
const response = await createAxios()
const { data } = await createAxios()
.post('token', bodyFormData)
.catch((err_response: any) => handleRequestError(err_response));
if (response == null) {
if (data == null) {
return false;
}
localStorage.setItem('login', JSON.stringify(response.data));
localStorage.setItem('login', JSON.stringify(data));
handleRequestError(response);
handleRequestError(data);
// Reload axios object.
createAxios();