Save finished games and add history views
This commit is contained in:
@@ -464,11 +464,18 @@ export class PlayApp {
|
||||
|
||||
onGameOver(data) {
|
||||
this.setStatus(`Game over: ${data.result} (${data.reason})`);
|
||||
this.showModal(
|
||||
"Game over",
|
||||
`${data.result.toUpperCase()} - ${data.reason}`,
|
||||
[{ label: "OK" }],
|
||||
);
|
||||
const actions = [{ label: "OK" }];
|
||||
if (data.game_id) {
|
||||
actions.unshift({
|
||||
label: "View saved game",
|
||||
className: "btn-primary",
|
||||
onClick: () => {
|
||||
window.location.href = `/games/${data.game_id}`;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
this.showModal("Game over", `${data.result.toUpperCase()} - ${data.reason}`, actions);
|
||||
}
|
||||
|
||||
onDrawOffered(data) {
|
||||
|
||||
Reference in New Issue
Block a user