1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

Переделка2

This commit is contained in:
MoonTestUse1
2025-01-02 02:43:36 +06:00
parent e751a3bd7d
commit 104ccda95b
5 changed files with 86 additions and 4 deletions

View File

@@ -26,7 +26,6 @@
"typescript": "^5.2.2",
"vite": "^5.1.4",
"vue-tsc": "^2.0.6",
"@tailwindcss/forms": "^0.5.7",
"@types/axios": "^0.14.0"
"@tailwindcss/forms": "^0.5.7"
}
}

7
frontend/src/types/axios.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
import axios from 'axios'
import type { AxiosInstance } from 'axios'
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$axios: AxiosInstance
}
}

71
frontend/src/types/shims-axios.d.ts vendored Normal file
View File

@@ -0,0 +1,71 @@
declare module 'axios' {
export interface AxiosResponse<T = any> {
data: T;
status: number;
statusText: string;
headers: any;
config: any;
request?: any;
}
export interface AxiosError<T = any> extends Error {
config: any;
code?: string;
request?: any;
response?: AxiosResponse<T>;
isAxiosError: boolean;
toJSON: () => object;
}
export interface AxiosRequestConfig {
url?: string;
method?: string;
baseURL?: string;
headers?: any;
params?: any;
data?: any;
timeout?: number;
withCredentials?: boolean;
responseType?: string;
xsrfCookieName?: string;
xsrfHeaderName?: string;
onUploadProgress?: (progressEvent: any) => void;
onDownloadProgress?: (progressEvent: any) => void;
maxContentLength?: number;
validateStatus?: (status: number) => boolean;
maxRedirects?: number;
httpAgent?: any;
httpsAgent?: any;
}
export interface AxiosInstance {
(config: AxiosRequestConfig): Promise<AxiosResponse>;
(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse>;
defaults: AxiosRequestConfig;
interceptors: {
request: any;
response: any;
};
getUri(config?: AxiosRequestConfig): string;
request<T = any, R = AxiosResponse<T>>(config: AxiosRequestConfig): Promise<R>;
get<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
delete<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
head<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
options<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
post<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
put<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
patch<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
}
export interface AxiosStatic extends AxiosInstance {
create(config?: AxiosRequestConfig): AxiosInstance;
Cancel: any;
CancelToken: any;
isCancel(value: any): boolean;
all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
}
const axios: AxiosStatic;
export default axios;
}

View File

@@ -486,4 +486,3 @@ const getStatusClass = (status: Request['status']) => {
// Загрузка данных при монтировании
onMounted(fetchData)
</script>
</script>

View File

@@ -18,6 +18,12 @@
},
"types": ["node", "vite/client"]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx",
"src/**/*.vue",
"vite.config.ts"
],
"references": [{ "path": "./tsconfig.node.json" }]
}