Draft: feat login
This commit is contained in:
34
plays/logout.go
Normal file
34
plays/logout.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user