adm-super-search-modal-2
Advanced tools
Comparing version 0.0.22 to 0.0.23
{ | ||
"name": "adm-super-search-modal-2", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"type": "module", | ||
@@ -33,3 +33,2 @@ "files": [ | ||
"@testing-library/vue": "^8.0.3", | ||
"@types/axios": "^0.14.0", | ||
"@types/node": "^20.11.28", | ||
@@ -40,3 +39,2 @@ "@typescript-eslint/eslint-plugin": "^6.4.0", | ||
"autoprefixer": "^10.4.18", | ||
"axios": "^1.6.8", | ||
"element-plus": "^2.6.1", | ||
@@ -43,0 +41,0 @@ "eslint": "^8.0.1", |
@@ -1,43 +0,43 @@ | ||
import axios, { AxiosInstance } from 'axios'; | ||
import { ISearchInfoResponse, ISearchQueryParams, ISearchQueryResponse } from './types'; | ||
function createApiClient(baseUrl: string, clientName?: string): AxiosInstance { | ||
return axios.create({ | ||
baseURL: baseUrl, | ||
withCredentials: false, | ||
headers: { | ||
common: { | ||
'Access-Control-Allow-Origin': '*', | ||
'Content-Type': 'application/json', | ||
'Access-Control-Allow-Methods': 'GET, PUT, POST, DELETE, OPTIONS', | ||
'Api-Client': clientName, | ||
}, | ||
}, | ||
}); | ||
} | ||
export default class SearchAPI { | ||
private apiClient: AxiosInstance | null; | ||
constructor(baseUrl: string, clientName?: string) { | ||
this.apiClient = createApiClient(baseUrl, clientName); | ||
} | ||
public async getSearchInfo() { | ||
const response = await this.apiClient?.get<ISearchInfoResponse>('/v1/search/info/'); | ||
return response?.data; | ||
} | ||
public async searchInstruments(query: ISearchQueryParams) { | ||
const response = await this.apiClient?.post<ISearchQueryResponse>( | ||
'/v1/search/query/', | ||
{ | ||
...query | ||
} | ||
); | ||
return response?.data; | ||
} | ||
} | ||
// import axios, { AxiosInstance } from 'axios'; | ||
// import { ISearchInfoResponse, ISearchQueryParams, ISearchQueryResponse } from './types'; | ||
// | ||
// function createApiClient(baseUrl: string, clientName?: string): AxiosInstance { | ||
// return axios.create({ | ||
// baseURL: baseUrl, | ||
// withCredentials: false, | ||
// headers: { | ||
// common: { | ||
// 'Access-Control-Allow-Origin': '*', | ||
// 'Content-Type': 'application/json', | ||
// 'Access-Control-Allow-Methods': 'GET, PUT, POST, DELETE, OPTIONS', | ||
// 'Api-Client': clientName, | ||
// }, | ||
// }, | ||
// }); | ||
// } | ||
// | ||
// | ||
// export default class SearchAPI { | ||
// private apiClient: AxiosInstance | null; | ||
// | ||
// constructor(baseUrl: string, clientName?: string) { | ||
// this.apiClient = createApiClient(baseUrl, clientName); | ||
// } | ||
// | ||
// public async getSearchInfo() { | ||
// const response = await this.apiClient?.get<ISearchInfoResponse>('/v1/search/info/'); | ||
// | ||
// return response?.data; | ||
// } | ||
// | ||
// public async searchInstruments(query: ISearchQueryParams) { | ||
// const response = await this.apiClient?.post<ISearchQueryResponse>( | ||
// '/v1/search/query/', | ||
// { | ||
// ...query | ||
// } | ||
// ); | ||
// | ||
// return response?.data; | ||
// } | ||
// } |
Sorry, the diff of this file is not supported yet
27
2321
120349