update onedrive account status

pull/548/head
微凉 2021-11-05 16:32:20 +08:00
parent 7e099b39cf
commit 11b141b190
1 changed files with 2 additions and 3 deletions

View File

@ -146,9 +146,11 @@ func (o Onedrive) RefreshToken(account *model.Account) error {
"refresh_token": account.RefreshToken,
}).Post(url)
if err != nil {
account.Status = err.Error()
return err
}
if e.Error != "" {
account.Status = e.ErrorDescription
return fmt.Errorf("%s", e.ErrorDescription)
}
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
@ -280,9 +282,6 @@ func (o Onedrive) Save(account *model.Account, old *model.Account) error {
return
}
err = o.RefreshToken(&newAccount)
if err != nil {
newAccount.Status = err.Error()
}
_ = model.SaveAccount(newAccount)
})
if err != nil {