makerequest принимает response type
This commit is contained in:
parent
be6f3cdce6
commit
230451ff78
@ -8,6 +8,7 @@ export async function makeRequest<TRequest = unknown, TResponse = unknown>({
|
||||
body,
|
||||
useToken = true,
|
||||
contentType = false,
|
||||
responseType = "json",
|
||||
signal,
|
||||
withCredentials,
|
||||
}: {
|
||||
@ -17,6 +18,7 @@ export async function makeRequest<TRequest = unknown, TResponse = unknown>({
|
||||
/** Send access token */
|
||||
useToken?: boolean;
|
||||
contentType?: boolean;
|
||||
responseType?: string;
|
||||
signal?: AbortSignal;
|
||||
/** Send refresh token */
|
||||
withCredentials?: boolean;
|
||||
@ -24,6 +26,7 @@ export async function makeRequest<TRequest = unknown, TResponse = unknown>({
|
||||
const headers: Record<string, string> = {};
|
||||
if (useToken) headers["Authorization"] = `Bearer ${getAuthToken()}`;
|
||||
if (contentType) headers["Content-Type"] = "application/json";
|
||||
headers["Response-Type"] = responseType;
|
||||
|
||||
try {
|
||||
const response = await axios<TRequest, AxiosResponse<TResponse & { accessToken?: string; }>>({
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@frontend/kitui",
|
||||
"version": "1.0.78",
|
||||
"version": "1.0.79",
|
||||
"description": "test",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
|
Loading…
Reference in New Issue
Block a user