From 3ad0d21e072c7461ea78a9a85111e6e19d3b0632 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Thu, 17 Apr 2025 17:46:05 +0200 Subject: Handle abandon game --- pkg/ui/views/game_api.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'pkg/ui/views/game_api.go') 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 -- cgit v1.2.3-18-g5258