diff options
| author | Paul Buetow <paul@buetow.org> | 2024-07-03 11:45:14 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-07-03 11:45:14 +0300 |
| commit | bfa17633390b7d7074bd584019e808eca4dd59a2 (patch) | |
| tree | 7f37104d27a7012604bd05e2994944091c62379b /internal/client | |
| parent | 4bde5943fa9bee99e8ad1e570d05e142cbacade7 (diff) | |
add no servers configured error
Diffstat (limited to 'internal/client')
| -rw-r--r-- | internal/client/tui/submit.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/client/tui/submit.go b/internal/client/tui/submit.go index 5507000..1176e3c 100644 --- a/internal/client/tui/submit.go +++ b/internal/client/tui/submit.go @@ -5,6 +5,8 @@ import ( "codeberg.org/snonux/gos/internal/config/client" config "codeberg.org/snonux/gos/internal/config/client" + "codeberg.org/snonux/gos/internal/easyhttp" + "codeberg.org/snonux/gos/internal/types" tea "github.com/charmbracelet/bubbletea" ) @@ -18,10 +20,16 @@ func submitAction(conf config.ClientConfig) tea.Cmd { } func submitMessage(conf client.ClientConfig, filePath string, callback func() error) tea.Cmd { + servers, err := conf.Servers() + if err == nil { + var entry types.Entry + err = easyhttp.PostData("/submit", conf.APIKey, &entry, servers...) + } + return func() tea.Msg { return finishedMsg{ callback: callback, - err: fmt.Errorf("This is a sample error"), + err: err, } } } |
