diff options
| author | Paul Buetow <paul@buetow.org> | 2024-07-28 18:46:41 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-07-28 18:46:41 +0300 |
| commit | 7fc95c18f169f0bfe0a5bc8a239ec5853619ec59 (patch) | |
| tree | 930f45563c8254205e2cac60b2eff234649362ed /internal/client/tui | |
| parent | 8572fca487d124518e46f4fad1919cf98c5ae56a (diff) | |
initial posting real data over
Diffstat (limited to 'internal/client/tui')
| -rw-r--r-- | internal/client/tui/submit.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/client/tui/submit.go b/internal/client/tui/submit.go index 90143d6..7e1f15c 100644 --- a/internal/client/tui/submit.go +++ b/internal/client/tui/submit.go @@ -14,17 +14,20 @@ import ( func submitAction(ctx context.Context, conf config.ClientConfig) tea.Cmd { composeFile := fmt.Sprintf("%s/%s", conf.DataDir, conf.ComposeFile) - return submitMessage(ctx, conf, composeFile, func() error { + return submitEntry(ctx, conf, composeFile, func() error { // This is the callback to call return nil }) } -func submitMessage(ctx context.Context, conf client.ClientConfig, filePath string, callback func() error) tea.Cmd { +func submitEntry(ctx context.Context, conf client.ClientConfig, filePath string, callback func() error) tea.Cmd { servers, err := conf.Servers() if err == nil { var entry types.Entry - err = easyhttp.PostData(ctx, "submit", conf.APIKey, &entry, servers...) + entry, err = types.NewEntryFromFile(filePath) + if err == nil { + err = easyhttp.PostData(ctx, "submit", conf.APIKey, &entry, servers...) + } } return func() tea.Msg { |
