Persist server configuration to config file

This commit is contained in:
2023-02-25 01:24:22 -07:00
parent a41c12d20c
commit 3fef157f6a
7 changed files with 110 additions and 53 deletions
+3 -8
View File
@@ -11,16 +11,11 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"git.ohea.xyz/cursorius/tui/settings"
"git.ohea.xyz/cursorius/tui/widget"
)
type CursoriusServer struct {
Name string
Url string
Token string
}
func (s CursoriusServer) Login() tea.Msg {
func ServerLogin(s settings.CursoriusServer) tea.Msg {
dashboard, err := createDashboard(s)
if err != nil {
return err
@@ -156,7 +151,7 @@ func (d dashboardItemDelegate) Render(w io.Writer, m list.Model, index int, list
fmt.Fprint(w, fn(str))
}
func createDashboard(s CursoriusServer) (Dashboard, error) {
func createDashboard(s settings.CursoriusServer) (Dashboard, error) {
client := graphql.NewClient(s.Url, http.DefaultClient)