🐛 fix account status

pull/548/head
微凉 2021-11-15 15:01:14 +08:00
parent 27e61c9eb8
commit f4942e89bd
3 changed files with 9 additions and 0 deletions

View File

@ -339,6 +339,8 @@ func (a AliDrive) RefreshToken(account *model.Account) error {
if e.Code != "" {
account.Status = e.Message
return fmt.Errorf("failed to refresh token: %s", e.Message)
}else {
account.Status = "work"
}
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
return nil

View File

@ -40,6 +40,11 @@ func (n Native) Save(account *model.Account, old *model.Account) error {
if !utils.Exists(account.RootFolder) {
return fmt.Errorf("[%s] not exist", account.RootFolder)
}
account.Status = "work"
err := model.SaveAccount(account)
if err != nil {
return err
}
return nil
}

View File

@ -153,6 +153,8 @@ func (o Onedrive) RefreshToken(account *model.Account) error {
if e.Error != "" {
account.Status = e.ErrorDescription
return fmt.Errorf("%s", e.ErrorDescription)
}else {
account.Status = "work"
}
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
return nil