Homepage.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <div>
  3. <input v-model="importAccountSchemaName"/>
  4. <button @click="importAccountSchema()">Import account schema</button>
  5. <hr />
  6. <h1>Sites</h1>
  7. <router-link to="/add">
  8. Add account
  9. </router-link>
  10. <accounts-list
  11. :accounts="accounts"
  12. />
  13. </div>
  14. </template>
  15. <script>
  16. import Field from '../components/Field.vue';
  17. import AccountsList from '../components/AccountsList.vue';
  18. import io from "../../io.js";
  19. export default {
  20. components: { Field, AccountsList },
  21. data: () => {
  22. return {
  23. accounts: [],
  24. importAccountSchemaName: ""
  25. }
  26. },
  27. methods: {
  28. importAccountSchema() {
  29. this.socket.emit("importAccountSchema", this.importAccountSchemaName, (res) => {
  30. console.log(res);
  31. alert(res.status);
  32. });
  33. },
  34. addAccount() {
  35. }
  36. },
  37. mounted() {
  38. io.getSocket(socket => {
  39. this.socket = socket;
  40. socket.emit("getAccounts", res => {
  41. this.accounts = res.accounts;
  42. //this.accounts = ["test", "test1", "test2"];
  43. });
  44. });
  45. }
  46. };
  47. </script>
  48. <style lang="scss" scoped>
  49. </style>