thomas 3 lat temu
rodzic
commit
fa6eaa712a
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      src/components/AdminCommands.vue

+ 4 - 2
src/components/AdminCommands.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
       <h3>Admin Session</h3>
-      <div v-for="request in requestCmds" :key="request.keyword"><button></button></div>
+      <div v-for="request in requestCmds" :key="request.keyword"><button @click="sendRequest(request)">{{ request.label }} </button></div>
       <div v-for="response in responses" :key="response.cnt">{{ response.data }}</div>
   </div>
 </template>
@@ -45,7 +45,9 @@ export default class AdminCommands extends Vue {
     this.socket = socket;
   }
 
-  sendRequest(keyword, options = {}) {
+  sendRequest(request) {
+    const keyword = request.keyword
+    const options = {}
     this.socket.emit('admin_request',{ request: keyword, options }, (data)=>{
       console.log({ got: data })
     })