Browse Source

add buttons

thomas 3 years ago
parent
commit
fa6eaa712a
1 changed files with 4 additions and 2 deletions
  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 })
     })