Last active
February 8, 2022 06:32
-
-
Save jacobduijzer/09f0e50dda9bab36ec378d9956162cdf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public async Task<CanbusData> Get(User user, Car car) | |
| { | |
| var unauthorizedApiPolicy = Policy | |
| .Handle<UnauthorizedAccessException>() | |
| .RetryAsync(async (exception, i, context) => await _canbusApi.AuthorizeCall()); | |
| var tokenExpiredPolicy = Policy | |
| .Handle<TokenExpiredException>() | |
| .RetryAsync(async (exception, i, context) => await _canbusApi.AuthenticateUser(user)); | |
| return await unauthorizedApiPolicy.WrapAsync(tokenExpiredPolicy) | |
| .ExecuteAsync(async () => await _canbusApi.GetCanbusData(user, car)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment