whoops;
This commit is contained in:
parent
47a918a8ef
commit
a19ae60600
1 changed files with 3 additions and 3 deletions
|
@ -47,10 +47,10 @@ func New(config *config.Config) *Osuapi {
|
|||
}
|
||||
|
||||
func (api *Osuapi) Token() (token string, err error) {
|
||||
return api.token(false)
|
||||
return api.tokenFetch(false)
|
||||
}
|
||||
|
||||
func (api *Osuapi) token(force bool) (token string, err error) {
|
||||
func (api *Osuapi) tokenFetch(force bool) (token string, err error) {
|
||||
if !force {
|
||||
if time.Now().Before(api.expires) {
|
||||
token = api.token
|
||||
|
@ -131,7 +131,7 @@ func (api *Osuapi) Request0(action string, url string) (resp *http.Response, err
|
|||
if resp.StatusCode != 200 {
|
||||
if resp.StatusCode == 401 {
|
||||
// force fetch token again
|
||||
api.token(true)
|
||||
api.tokenFetch(true)
|
||||
log.Println("re-fetched token cus expired")
|
||||
return api.Request0(action, url)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue