Is your feature request related to a problem?
The current H5GroveProvider only allows configuration of the Axios client through the axiosConfig?: AxiosRequestConfig property.
However, in some cases, it is more useful to provide a fully customized Axios instance, which may include additional features such as interceptors.
Requested solution or feature
One simple solution can be to provide a custom derived H5GroveApiAxiosInstance that override the client, and then a new H5GroveCustomProvider (code not provided here):
import axios, {
AxiosInstance
}
import h5grove, {
DataProviderApi,
H5GroveApi
}
export class H5GroveApiAxiosInstance extends H5GroveApi {
private readonly client: AxiosInstance;
public constructor(
url: string,
filepath: string,
axiosClient?: AxiosInstance,
private readonly _getExportURL?: DataProviderApi['getExportURL'],
) {
super(filepath);
this.client = axiosClient
}
}
Alternatives you've considered
Directly modify the H5GroveProvider & H5GroveApi.
Additional context
In our application, for example, we use interceptors to ensure that the current user has a valid token, refresh it when necessary, and handle other authentication-related logic.
PS: thanks for the actual developments!
Is your feature request related to a problem?
The current
H5GroveProvideronly allows configuration of the Axios client through theaxiosConfig?: AxiosRequestConfigproperty.However, in some cases, it is more useful to provide a fully customized Axios instance, which may include additional features such as interceptors.
Requested solution or feature
One simple solution can be to provide a custom derived
H5GroveApiAxiosInstancethat override the client, and then a newH5GroveCustomProvider(code not provided here):Alternatives you've considered
Directly modify the
H5GroveProvider&H5GroveApi.Additional context
In our application, for example, we use interceptors to ensure that the current user has a valid token, refresh it when necessary, and handle other authentication-related logic.
PS: thanks for the actual developments!