Skip to content

Commit

Permalink
fix: resolve circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanharris committed Apr 9, 2024
1 parent 21a5c26 commit 1708f0e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";

import { Configuration } from "./configuration";
import { Credentials } from "./credentials";
import type { Credentials } from "./credentials";
import {
FgaApiError,
FgaApiInternalError,
Expand Down Expand Up @@ -180,15 +180,13 @@ export async function attemptHttpRequest<B, R>(
/**
* creates an axios request function
*/
export const createRequestFunction = function (axiosArgs: RequestArgs, axiosInstance: AxiosInstance, configuration: Configuration, credentials?: Credentials) {
export const createRequestFunction = function (axiosArgs: RequestArgs, axiosInstance: AxiosInstance, configuration: Configuration, credentials: Credentials) {
configuration.isValid();

const retryParams = axiosArgs.options?.retryParams ? axiosArgs.options?.retryParams : configuration.retryParams;
const maxRetry:number = retryParams ? retryParams.maxRetry : 0;
const minWaitInMs:number = retryParams ? retryParams.minWaitInMs : 0;
if (!credentials) {
credentials = Credentials.init(configuration);
}

return async (axios: AxiosInstance = axiosInstance) : PromiseResult<any> => {
await setBearerAuthToObject(axiosArgs.options.headers, credentials!);

Expand Down

0 comments on commit 1708f0e

Please sign in to comment.