diff options
Diffstat (limited to 'internal/api.go')
| -rw-r--r-- | internal/api.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/api.go b/internal/api.go index a987f00..b615976 100644 --- a/internal/api.go +++ b/internal/api.go @@ -24,8 +24,12 @@ func apiAuthorized(server Server, method string, endpoint string, opts *HTTPOpti url := base.Endpoints.API.V3.API + endpoint // Ensure we have valid tokens + stateBefore := base.FSM.Current oauthErr := EnsureTokens(server) + // we reset the state so that we go from the authorized state to the state we want + base.FSM.Current = stateBefore + if oauthErr != nil { return nil, nil, oauthErr } @@ -83,7 +87,11 @@ func APIInfo(server Server) error { if baseErr != nil { return &APIInfoError{Err: baseErr} } + + // Store the profiles and make sure that the current profile is not overwritten + previousProfile := base.Profiles.Current base.Profiles = structure + base.Profiles.Current = previousProfile base.ProfilesRaw = string(body) return nil } |
