-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
824 streamline frontend change level network calls (#839)
- Loading branch information
1 parent
00a5068
commit ee5bec5
Showing
32 changed files
with
385 additions
and
325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Response } from 'express'; | ||
|
||
import { LevelGetRequest } from '@src/models/api/LevelGetRequest'; | ||
import { isValidLevel } from '@src/models/level'; | ||
|
||
function handleLoadLevel(req: LevelGetRequest, res: Response) { | ||
const { level } = req.query; | ||
|
||
if (level === undefined) { | ||
res.status(400).send('Level not provided'); | ||
return; | ||
} | ||
|
||
if (!isValidLevel(level)) { | ||
res.status(400).send('Invalid level'); | ||
return; | ||
} | ||
|
||
res.send({ | ||
emails: req.session.levelState[level].sentEmails, | ||
chatHistory: req.session.levelState[level].chatHistory, | ||
defences: req.session.levelState[level].defences, | ||
}); | ||
} | ||
|
||
export { handleLoadLevel }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Request } from 'express'; | ||
|
||
import { ChatMessage } from '@src/models/chatMessage'; | ||
import { Defence } from '@src/models/defence'; | ||
import { EmailInfo } from '@src/models/email'; | ||
import { LEVEL_NAMES } from '@src/models/level'; | ||
|
||
export type LevelGetRequest = Request< | ||
never, | ||
{ | ||
emails: EmailInfo[]; | ||
chatHistory: ChatMessage[]; | ||
defences: Defence[]; | ||
}, | ||
never, | ||
{ | ||
level?: LEVEL_NAMES; | ||
} | ||
>; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.