fix: 修复前端 TypeScript 类型错误并移除 docker-compose.yml 中的 version 属性
- 移除 docker-compose.yml 中的 version 属性(已过时) - 修复 RouteLocationNormalized 类型导入错误 - 修复 AxiosRequestConfig 类型错误,使用 InternalAxiosRequestConfig - 添加 Vite 环境变量类型定义 - 扩展 axios 类型定义,正确处理响应拦截器返回的 data - 修复 signature.ts 中未使用的 body 参数 bug - 移除 UserManagement.vue 中未使用的 StatusHelper 导入
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
import type { RouteRecordRaw, RouteLocationNormalized } from 'vue-router'
|
||||
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta {
|
||||
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
import { AxiosRequestConfig, AxiosInstance } from 'axios'
|
||||
|
||||
declare module 'axios' {
|
||||
interface AxiosInstance {
|
||||
request<T = any>(config: AxiosRequestConfig): Promise<T>
|
||||
get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>
|
||||
delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>
|
||||
head<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>
|
||||
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
|
||||
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
|
||||
patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import axios, { AxiosRequestConfig } from 'axios'
|
||||
import axios, { InternalAxiosRequestConfig } from 'axios'
|
||||
import { generateSignatureHeaders } from './signature'
|
||||
import { checkApiPermission } from './permission'
|
||||
|
||||
@@ -8,7 +8,7 @@ const request = axios.create({
|
||||
})
|
||||
|
||||
request.interceptors.request.use(
|
||||
(config: AxiosRequestConfig) => {
|
||||
(config: InternalAxiosRequestConfig) => {
|
||||
const token = localStorage.getItem('token')
|
||||
if (token) {
|
||||
config.headers = config.headers || {}
|
||||
|
||||
@@ -16,7 +16,7 @@ export function generateSignature(
|
||||
timestamp: number,
|
||||
nonce: string
|
||||
): string {
|
||||
const stringToSign = buildStringToSign(method, path, query, '', timestamp, nonce)
|
||||
const stringToSign = buildStringToSign(method, path, query, body, timestamp, nonce)
|
||||
|
||||
const signature = CryptoJS.HmacSHA256(stringToSign, SIGNATURE_SECRET)
|
||||
const signatureBase64 = CryptoJS.enc.Base64.stringify(signature)
|
||||
|
||||
@@ -226,7 +226,7 @@ import { Search } from '@element-plus/icons-vue'
|
||||
import { userApi, type User, type CreateUserRequest, type UpdateUserRequest } from '@/api/user.api'
|
||||
import { roleApi, type Role } from '@/api/role.api'
|
||||
import { handleApiError } from '@/utils/errorHandler'
|
||||
import { UserStatus, StatusHelper } from '@/constants/status'
|
||||
import { UserStatus } from '@/constants/status'
|
||||
import { formatDateTime } from '@/utils/dateFormat'
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_SIGNATURE_SECRET: string
|
||||
readonly VITE_API_BASE_URL?: string
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv
|
||||
}
|
||||
Reference in New Issue
Block a user