From 7fc95c18f169f0bfe0a5bc8a239ec5853619ec59 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 28 Jul 2024 18:46:41 +0300 Subject: initial posting real data over --- internal/client/tui/submit.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'internal/client') 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 { -- cgit v1.2.3