Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
api?: string;
};
const requestMiddleware: RequestInterceptor = () => async action => {
await new Promise(resolve => setTimeout(resolve, 2000));
return action;
};
const responseMiddleware: ResponseInterceptor = () => async (action, response) => {
await new Promise(resolve => setTimeout(resolve, 2000));
return response;
};
const client = Client({
requestInterceptors: [requestMiddleware],
responseInterceptors: [responseMiddleware],
});
type ApiResponse = {
question: string;
};
const exampleAction = (): Action => ({
method: 'GET',
endpoint: 'https://private-34f3a-reactapiclient.apiary-mock.com/questions',
api: 'test',
});
const examplePaginatedQuery = (page: number): Action => {
return {