Parcourir la source

fix: payload type error

Nivek il y a 2 ans
Parent
commit
3324c7daf6
2 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 1 1
      src/api/product.ts
  2. 1 1
      src/views/product/CreateProduct.vue

+ 1 - 1
src/api/product.ts

@@ -6,7 +6,7 @@ type ProductInfo = {
     name: string,
     category: string,
     price: number,
-    photoUrlList: [string]
+    photoUrlList: string[]
 }
 
 // 创建商品

+ 1 - 1
src/views/product/CreateProduct.vue

@@ -28,7 +28,7 @@ function handleCreateProduct() {
     name: name.value,
     category: category.value,
     price: price.value,
-    photoUrlList: photoUrlList.value
+    photoUrlList: photoUrlList.value.filter(url => url !== '')
   };
   createProduct(payload).then(res => {
     if (res.data.code === '000') {