Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support refresh token #26

Closed
vanthanhtran245 opened this issue Jan 25, 2021 · 4 comments
Closed

Support refresh token #26

vanthanhtran245 opened this issue Jan 25, 2021 · 4 comments

Comments

@vanthanhtran245
Copy link

Seems this project not yet support request retry adapter like Alamofire. It would be great if it is supported in the next version

@s4cha
Copy link
Member

s4cha commented Sep 17, 2021

@vanthanhtran245 this looks like a good idea, feel free to take a shot at it in a PR.

@denis-obukhov
Copy link
Contributor

denis-obukhov commented Oct 25, 2021

#36
Sample use case:

private var isRetrying = CurrentValueSubject<Bool, Error>(false)

init() {
    restAPI.network.requestRetrier = { [unowned self] _, error in
        if self.isRetrying.value == true {
            return self.isRetrying.filter({ !$0 }).asVoid().eraseToAnyPublisher()
        }
        guard let error = error as? NetworkingError, error.status == .unauthorized else {
            return nil
        }
        return restAPI.authenticate().eraseToAnyPublisher()
    }
}

@s4cha
Copy link
Member

s4cha commented Oct 28, 2021

@vanthanhtran245 this is live in 0.3.4, does that solve your use case ?

@s4cha
Copy link
Member

s4cha commented Nov 28, 2021

Closing this for now, as this feature has been added in latest version. Feel free to reopen if needed

@s4cha s4cha closed this as completed Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants