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
import { AxiosError, AxiosResponse } from "axios"; | |
import { useCallback, useEffect, useState } from "react"; | |
interface UseFetchProps<DataType = object> { | |
/** | |
* Default is `true` | |
*/ | |
initialFetch?: boolean; | |
fetch: () => Promise<AxiosResponse<DataType, any>>; | |
errorCallback?: () => void; |
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
/// <summary> | |
/// A DelegatingHandler that retries the request if it fails due to an expired token. | |
/// </summary> | |
sealed class RetryHandler : DelegatingHandler | |
{ | |
private const int _maxRetries = 3; | |
private string? _accessToken = null; | |
public RetryHandler( | |
HttpMessageHandler innerHandler |