|
@@ -2,6 +2,7 @@ package login
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"errors"
|
|
"errors"
|
|
|
|
|
+ "log/slog"
|
|
|
|
|
|
|
|
"github.com/ayn2op/discordo/internal/config"
|
|
"github.com/ayn2op/discordo/internal/config"
|
|
|
"github.com/diamondburned/arikawa/v3/api"
|
|
"github.com/diamondburned/arikawa/v3/api"
|
|
@@ -10,7 +11,7 @@ import (
|
|
|
"github.com/zalando/go-keyring"
|
|
"github.com/zalando/go-keyring"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
-type DoneFn = func(token string, err error)
|
|
|
|
|
|
|
+type DoneFn = func(token string)
|
|
|
|
|
|
|
|
type Form struct {
|
|
type Form struct {
|
|
|
*tview.Flex
|
|
*tview.Flex
|
|
@@ -141,14 +142,11 @@ func (self *Form) login() {
|
|
|
go keyring.Set(config.Name, "token", resp.Token)
|
|
go keyring.Set(config.Name, "token", resp.Token)
|
|
|
|
|
|
|
|
if self.done != nil {
|
|
if self.done != nil {
|
|
|
- self.done(resp.Token, nil)
|
|
|
|
|
|
|
+ self.done(resp.Token)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (self *Form) onError(err error) {
|
|
func (self *Form) onError(err error) {
|
|
|
|
|
+ slog.Error("failed to login", "err", err)
|
|
|
self.errorTextView.SetText(err.Error())
|
|
self.errorTextView.SetText(err.Error())
|
|
|
-
|
|
|
|
|
- if self.done != nil {
|
|
|
|
|
- self.done("", err)
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|