mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-19 08:58:09 +01:00
Build/Refactor: lint pre-commit hook and reformat repo to spec (#314)
* build/refactor: move lint/prettier packages to project root, install husky, add pre-commit hook * refactor: reformat files * build: put full eslintrc back with all rules
This commit is contained in:
parent
8d75b25104
commit
7fdc862042
157 changed files with 4836 additions and 2403 deletions
|
|
@ -1,32 +1,28 @@
|
|||
import axios, { AxiosRequestConfig } from "axios";
|
||||
import axios, { AxiosRequestConfig } from 'axios';
|
||||
|
||||
async function _get<T>(url: string, options?: AxiosRequestConfig): Promise<T> {
|
||||
const response = await axios.get(url, { ...options});
|
||||
const response = await axios.get(url, { ...options });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function _post(url: string, data?: any) {
|
||||
const response = await axios.post(url, JSON.stringify(data), {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function _postMultiPart(
|
||||
url: string,
|
||||
formData: FormData,
|
||||
options?: AxiosRequestConfig
|
||||
) {
|
||||
async function _postMultiPart(url: string, formData: FormData, options?: AxiosRequestConfig) {
|
||||
const response = await axios.post(url, formData, {
|
||||
...options,
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function _put(url: string, data?: any) {
|
||||
const response = await axios.put(url, JSON.stringify(data), {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
|
@ -36,17 +32,14 @@ async function _delete<T>(url: string): Promise<T> {
|
|||
return response.data;
|
||||
}
|
||||
|
||||
async function _deleteWithOptions<T>(
|
||||
url: string,
|
||||
options?: AxiosRequestConfig
|
||||
): Promise<T> {
|
||||
const response = await axios.delete(url, {...options});
|
||||
async function _deleteWithOptions<T>(url: string, options?: AxiosRequestConfig): Promise<T> {
|
||||
const response = await axios.delete(url, { ...options });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function _patch(url: string, data?: any) {
|
||||
const response = await axios.patch(url, JSON.stringify(data), {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
|
@ -58,5 +51,5 @@ export default {
|
|||
put: _put,
|
||||
delete: _delete,
|
||||
deleteWithOptions: _deleteWithOptions,
|
||||
patch: _patch,
|
||||
patch: _patch
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue