Draft: feat login

This commit is contained in:
2025-09-05 03:59:25 +08:00
parent 6d7074198f
commit ca49efac87
43 changed files with 2023 additions and 91 deletions

34
plays/logout.go Normal file
View File

@@ -0,0 +1,34 @@
package plays
import tea "github.com/charmbracelet/bubbletea"
type Logout struct{ *Base }
func NewLogout(base *Base) *Logout {
return &Logout{Base: base}
}
func (m *Logout) Init() tea.Cmd {
return tea.ClearScreen
}
func (m *Logout) Update(tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Quit
}
func (m *Logout) View() string {
return "Logout"
}
func (m *Logout) Next(queue *[]*tea.Program) error {
_, _ = m.Base.client.R().
Post("/auth/logout")
// cleanup
m.Base.client.
SetBasicAuth("", "")
*queue = append(*queue,
tea.NewProgram(NewLanding(m.Base)))
return nil
}