Browse Source

封装文件上传

Lijy 1 year ago
parent
commit
dc8699c20a
1 changed files with 14 additions and 0 deletions
  1. 14 0
      fhKeeper/formulahousekeeper/customerBuler-crm/src/utils/request.ts

+ 14 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/utils/request.ts

@@ -67,3 +67,17 @@ export async function post(url: string, data?: any): Promise<any> {
       throw error;
     });
 }
+
+// 封装文件上传请求
+export async function uploadFile(url: string, data?: any): Promise<any> {
+  return instance
+    .post(url, data, {
+      headers: {
+        "Content-type": "multipart/form-data",
+      },
+    })
+    .then((response) => response.data)
+    .catch((error) => {
+      throw error;
+    });
+}