mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-11-25 19:37:41 +08:00
🐛 fix account status
This commit is contained in:
@@ -339,6 +339,8 @@ func (a AliDrive) RefreshToken(account *model.Account) error {
|
|||||||
if e.Code != "" {
|
if e.Code != "" {
|
||||||
account.Status = e.Message
|
account.Status = e.Message
|
||||||
return fmt.Errorf("failed to refresh token: %s", e.Message)
|
return fmt.Errorf("failed to refresh token: %s", e.Message)
|
||||||
|
}else {
|
||||||
|
account.Status = "work"
|
||||||
}
|
}
|
||||||
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
|
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ func (n Native) Save(account *model.Account, old *model.Account) error {
|
|||||||
if !utils.Exists(account.RootFolder) {
|
if !utils.Exists(account.RootFolder) {
|
||||||
return fmt.Errorf("[%s] not exist", account.RootFolder)
|
return fmt.Errorf("[%s] not exist", account.RootFolder)
|
||||||
}
|
}
|
||||||
|
account.Status = "work"
|
||||||
|
err := model.SaveAccount(account)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,8 @@ func (o Onedrive) RefreshToken(account *model.Account) error {
|
|||||||
if e.Error != "" {
|
if e.Error != "" {
|
||||||
account.Status = e.ErrorDescription
|
account.Status = e.ErrorDescription
|
||||||
return fmt.Errorf("%s", e.ErrorDescription)
|
return fmt.Errorf("%s", e.ErrorDescription)
|
||||||
|
}else {
|
||||||
|
account.Status = "work"
|
||||||
}
|
}
|
||||||
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
|
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user