mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2026-04-01 08:21:48 +02:00
Check input schema (#33)
This commit is contained in:
1533
ui/src/client/api.ts
1533
ui/src/client/api.ts
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@
|
||||
import { Configuration } from "./configuration";
|
||||
// Some imports not used depending on template conditions
|
||||
// @ts-ignore
|
||||
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
||||
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
||||
|
||||
export const BASE_PATH = "http://./api".replace(/\/+$/, "");
|
||||
|
||||
@@ -38,7 +38,7 @@ export const COLLECTION_FORMATS = {
|
||||
*/
|
||||
export interface RequestArgs {
|
||||
url: string;
|
||||
options: any;
|
||||
options: AxiosRequestConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -131,8 +131,8 @@ export const toPathString = function (url: URL) {
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user