diff options
| author | Paul Buetow <paul@buetow.org> | 2024-07-01 11:13:41 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-07-01 11:13:41 +0300 |
| commit | 0fa5420bfaed55ecbb43e98a18138aed7f658660 (patch) | |
| tree | 1f9e6c650455226da3f436c4f7e967f657384a25 /internal/client/tui/submit.go | |
| parent | ecc323b3b45e666a3376d7983424837d58336198 (diff) | |
display error message in TUI
Diffstat (limited to 'internal/client/tui/submit.go')
| -rw-r--r-- | internal/client/tui/submit.go | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/internal/client/tui/submit.go b/internal/client/tui/submit.go index 15b7826..5507000 100644 --- a/internal/client/tui/submit.go +++ b/internal/client/tui/submit.go @@ -3,30 +3,25 @@ package tui import ( "fmt" + "codeberg.org/snonux/gos/internal/config/client" config "codeberg.org/snonux/gos/internal/config/client" tea "github.com/charmbracelet/bubbletea" ) func submitAction(conf config.ClientConfig) tea.Cmd { - // The composed file is now the file to be submitted. - //submitFile := fmt.Sprintf("%s/%s", conf.DataDir, conf.ComposeFile) + composeFile := fmt.Sprintf("%s/%s", conf.DataDir, conf.ComposeFile) - /* - c := &http.Client{ - Timeout: 10 * time.Second, - } - res, err := c.Get(url) - if err != nil { - return sub{err} - } - defer res.Body.Close() - */ + return submitMessage(conf, composeFile, func() error { + // This is the callback to call + return nil + }) +} +func submitMessage(conf client.ClientConfig, filePath string, callback func() error) tea.Cmd { return func() tea.Msg { - err := fmt.Errorf("this is a test errorrrrrr!") return finishedMsg{ - err: err, + callback: callback, + err: fmt.Errorf("This is a sample error"), } } - } |
