File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 77 "github.com/charmbracelet/bubbles/textinput"
88 tea "github.com/charmbracelet/bubbletea"
99 "github.com/charmbracelet/lipgloss"
10+ "github.com/j0h-dev/my-spotify-playlist-sorter-go/internal/config"
1011 "github.com/j0h-dev/my-spotify-playlist-sorter-go/internal/domain"
1112 "github.com/j0h-dev/my-spotify-playlist-sorter-go/internal/spotify"
1213)
@@ -44,6 +45,7 @@ type LoginModel struct {
4445}
4546
4647func NewLoginModel () * LoginModel {
48+
4749 // initialize text inputs
4850 clientIdField := textinput .New ()
4951 clientIdField .Placeholder = "client id"
@@ -61,6 +63,12 @@ func NewLoginModel() *LoginModel {
6163 clientRedirectField .Prompt = "Redirect URI: "
6264 clientRedirectField .Width = 80
6365
66+ conf := config .ReadConfig ()
67+ if conf .Credentials != nil {
68+ clientIdField .SetValue (conf .Credentials .ClientID )
69+ clientRedirectField .SetValue (conf .Credentials .RedirectURI )
70+ }
71+
6472 loadingSpinner := spinner .New ()
6573 loadingSpinner .Spinner = spinner .Dot
6674 loadingSpinner .Style = lipgloss .NewStyle ().Foreground (lipgloss .Color ("205" ))
You can’t perform that action at this time.
0 commit comments