Fix post-game analysis state, add profile nav route, and fix mobile profile overflow
This commit is contained in:
parent
02b8bafb1e
commit
3ccab53b41
7 changed files with 158 additions and 23 deletions
|
|
@ -578,17 +578,21 @@ export function createHttpHandler(deps: {
|
|||
|
||||
if (gameId && !segments[2] && method === 'GET') {
|
||||
const active = gameManager.getGameState(gameId);
|
||||
if (active) {
|
||||
if (active && !active.finished) {
|
||||
sendJson(res, 200, { kind: 'active', game: active });
|
||||
return;
|
||||
}
|
||||
const stored = db.getGameById(gameId);
|
||||
if (!stored) {
|
||||
sendJson(res, 404, { error: 'Game not found.' });
|
||||
if (stored) {
|
||||
const analysis = db.getAnalysis(gameId);
|
||||
sendJson(res, 200, { kind: 'stored', game: stored, analysis });
|
||||
return;
|
||||
}
|
||||
const analysis = db.getAnalysis(gameId);
|
||||
sendJson(res, 200, { kind: 'stored', game: stored, analysis });
|
||||
if (active) {
|
||||
sendJson(res, 200, { kind: 'active', game: active });
|
||||
return;
|
||||
}
|
||||
sendJson(res, 404, { error: 'Game not found.' });
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue