responsetype в конфиг
This commit is contained in:
parent
230451ff78
commit
08a3edb3e3
@ -1,4 +1,4 @@
|
||||
import axios, { AxiosResponse, Method } from "axios";
|
||||
import axios, { AxiosResponse, Method, ResponseType } from "axios";
|
||||
import { getAuthToken, setAuthToken } from "../stores/auth";
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ export async function makeRequest<TRequest = unknown, TResponse = unknown>({
|
||||
/** Send access token */
|
||||
useToken?: boolean;
|
||||
contentType?: boolean;
|
||||
responseType?: string;
|
||||
responseType?: ResponseType;
|
||||
signal?: AbortSignal;
|
||||
/** Send refresh token */
|
||||
withCredentials?: boolean;
|
||||
@ -26,7 +26,6 @@ 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; }>>({
|
||||
@ -35,6 +34,7 @@ export async function makeRequest<TRequest = unknown, TResponse = unknown>({
|
||||
headers,
|
||||
data: body,
|
||||
signal,
|
||||
responseType,
|
||||
withCredentials,
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@frontend/kitui",
|
||||
"version": "1.0.79",
|
||||
"version": "1.0.80",
|
||||
"description": "test",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
|
Loading…
Reference in New Issue
Block a user