소스 검색

♻️ refactor(upload): optimize uid generation and type imports

- 修改随机字符串长度,从substr(2,9)调整为substring(2,11)以增加uid唯一性
- 移除minio工具中未使用的InferRequestType导入,精简依赖
yourname 2 달 전
부모
커밋
1bf9aefc6c
2개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      src/client/admin/components/MinioUploader.tsx
  2. 1 1
      src/client/utils/minio.ts

+ 1 - 1
src/client/admin/components/MinioUploader.tsx

@@ -169,7 +169,7 @@ const MinioUploader: React.FC<MinioUploaderProps> = ({
 
   // 自定义上传逻辑
   const handleUpload = async (file: File) => {
-    const uid = Date.now().toString() + Math.random().toString(36).substr(2, 9);
+    const uid = Date.now().toString() + Math.random().toString(36).substring(2, 11);
     
     // 添加到文件列表
     setFileList(prev => [

+ 1 - 1
src/client/utils/minio.ts

@@ -1,4 +1,4 @@
-import type { InferResponseType, InferRequestType } from 'hono/client';
+import type { InferResponseType } from 'hono/client';
 import { fileClient } from "../api";
 
 export interface MinioProgressEvent {