Browse Source

show no result

thomas 3 years ago
parent
commit
14fddbae2c
1 changed files with 9 additions and 3 deletions
  1. 9 3
      src/components/AdminCommands.vue

+ 9 - 3
src/components/AdminCommands.vue

@@ -35,11 +35,17 @@ export default class AdminCommands extends Vue {
   cnt = 0
 
   setResponse(data) {
-    if(! Array.isArray(data)) {
-      data = []
+    this.responses = []
+
+    if(Array.isArray(data) == false || data.length == 0) {
+      this.cnt++
+      this.responses.push({
+        cnt: this.cnt,
+        data: 'no results'
+      })
+      return
     }
 
-    this.responses = []
     for (let index = 0; index < data.length; index++) {
       this.cnt++
       this.responses.push({