summaryrefslogtreecommitdiff
path: root/ui.go
diff options
context:
space:
mode:
authorDavid Schlachter <t480-debian-git@schlachter.ca>2026-01-08 11:22:29 -0500
committerDavid Schlachter <t480-debian-git@schlachter.ca>2026-01-08 11:22:29 -0500
commitc540abdd1d1465227e9b6b387570ee5a4d267bf4 (patch)
tree4f16e9caafa0a5c1f1432d0c628358f1314a5814 /ui.go
parent63c3a174827aa431237e80bb210166dcd0e186dc (diff)
Make API url configurable
Diffstat (limited to 'ui.go')
-rw-r--r--ui.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/ui.go b/ui.go
index 9855203..e4eb311 100644
--- a/ui.go
+++ b/ui.go
@@ -27,6 +27,7 @@ type model struct {
vp viewport.Model
ankiDeck string
ankiModel string
+ apiURL string
}
type (
@@ -35,7 +36,7 @@ type (
wordAddedMsg string
)
-func initialModel(c *http.Client, db *sql.DB, ankiDeck, ankiModel string) model {
+func initialModel(c *http.Client, db *sql.DB, apiURL, ankiDeck, ankiModel string) model {
ti := textinput.New()
ti.Placeholder = ""
ti.Focus()
@@ -53,6 +54,7 @@ func initialModel(c *http.Client, db *sql.DB, ankiDeck, ankiModel string) model
vp: vp,
ankiDeck: ankiDeck,
ankiModel: ankiModel,
+ apiURL: apiURL,
}
}
@@ -109,7 +111,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.wordInput.SetValue("")
m.vp.SetContent("")
case tea.KeyEnter:
- return m, addCard(m.c, m.ankiDeck, m.ankiModel, m.currentWord, m.currentDefinition)
+ return m, addCard(m.c, m.apiURL, m.ankiDeck, m.ankiModel, m.currentWord, m.currentDefinition)
}
case errMsg: