diff options
author | Santo Cariotti <santo@dcariotti.me> | 2025-04-17 17:46:05 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2025-04-17 17:46:05 +0200 |
commit | 3ad0d21e072c7461ea78a9a85111e6e19d3b0632 (patch) | |
tree | 186045fd7b6ecd6c25c1deab504f25297bf6e134 /pkg/ui/views/game_api.go | |
parent | 95da822f025b544f700729afc676ba0f3c981154 (diff) |
Handle abandon game
Diffstat (limited to 'pkg/ui/views/game_api.go')
-rw-r--r-- | pkg/ui/views/game_api.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/ui/views/game_api.go b/pkg/ui/views/game_api.go index 75aa0a1..34ba1f3 100644 --- a/pkg/ui/views/game_api.go +++ b/pkg/ui/views/game_api.go @@ -68,9 +68,11 @@ func (m *GameModel) getGame() tea.Cmd { } } -type EndGameMsg struct{} +type EndGameMsg struct { + abandoned bool +} -func (m *GameModel) endGame() tea.Cmd { +func (m *GameModel) endGame(outcome string) tea.Cmd { return func() tea.Msg { var game database.Game @@ -82,7 +84,7 @@ func (m *GameModel) endGame() tea.Cmd { // Prepare request payload payload, err := json.Marshal(map[string]string{ - "outcome": m.chessGame.Outcome().String(), + "outcome": outcome, }) // Send API request |