浏览代码

modify test celery file

tomoya 2 年之前
父节点
当前提交
a1eb68e2de
共有 4 个文件被更改,包括 11 次插入7 次删除
  1. 1 1
      frontend/README.md
  2. 2 3
      frontend/src/api.ts
  3. 1 1
      frontend/src/stores/admin.ts
  4. 7 2
      frontend/src/views/main/admin/TestCelery.vue

+ 1 - 1
frontend/README.md

@@ -1,4 +1,4 @@
-# frontvue
+# frontend
 
 This template should help get you started developing with Vue 3 in Vite.
 

+ 2 - 3
frontend/src/api.ts

@@ -2,11 +2,10 @@ import axios from "axios";
 import { apiUrl } from "@/env";
 import type { IUserProfile, IUserProfileUpdate, IUserProfileCreate, IUserProfileRegister } from "@/interfaces";
 
-function authHeaders(token: string, contentType:string="application/json") {
+function authHeaders(token: string) {
   return {
     headers: {
       Authorization: `Bearer ${token}`,
-      "Content-Type": contentType,
     },
   };
 }
@@ -56,6 +55,6 @@ export const api = {
   async testCeleryFile(token: string, file: File){
     const formData = new FormData();
     formData.append("file", file)
-    return axios.post<{msg:string}>(`${apiUrl}/api/v1/utils/test-celery/file`, formData, authHeaders(token, "maltipart/form-data"));
+    return axios.post<{msg:string}>(`${apiUrl}/api/v1/utils/test-celery/file`, formData, authHeaders(token));
   },
 };

+ 1 - 1
frontend/src/stores/admin.ts

@@ -105,7 +105,7 @@ export const useAdminStore = defineStore("AdminStoreId", {
             await mainStore.checkApiError(error);
           }
         },
-        async actionTestCeleryFile(payload: {file: File}) {
+        async actionTestCeleryFile(payload: File) {
           const mainStore = useMainStore();
           try {
             const loadingNotification = { content: "sending", showProgress: true };

+ 7 - 2
frontend/src/views/main/admin/TestCelery.vue

@@ -6,7 +6,12 @@
       </v-card-title>
       <v-card-text>
           <v-form v-model="validMsg" ref="msgForm">
-            <v-text-field @keyup.enter="msgSubmit" label="Message" v-model="msg" :rules="required" ></v-text-field>
+            <v-text-field 
+              @keyup.enter="msgSubmit" 
+              label="Message" v-model="msg" 
+              :rules="required"
+              prepend-icon="message">
+            </v-text-field>
           </v-form>
       </v-card-text>
       <v-card-actions>
@@ -24,7 +29,7 @@
           <v-form v-model="validFile" ref="fileForm">
             <v-file-input
               v-model="zipFiles"
-              :rules="[v=>!v]"
+              :rules="[v=> v.length || 'select zip file.']"
               accept=".zip"
               label="File input"
               prepend-icon="folder_zip"