AddAccount.vue 630 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <main>
  3. <h1>Add account</h1>
  4. <hr/>
  5. <br/>
  6. <account-form :onSubmit="onSubmit"/>
  7. </main>
  8. </template>
  9. <script>
  10. import AccountForm from '../components/AccountForm.vue';
  11. import io from "../../io.js";
  12. export default {
  13. components: { AccountForm },
  14. data: () => {
  15. return {
  16. }
  17. },
  18. methods: {
  19. onSubmit(account) {
  20. this.socket.emit("account.add", account, (res) => {
  21. console.log(res);
  22. if (res.status === "success") {
  23. this.$router.push("/accounts")
  24. }
  25. });
  26. }
  27. },
  28. mounted() {
  29. io.getSocket(socket => {
  30. this.socket = socket;
  31. });
  32. }
  33. };
  34. </script>
  35. <style lang="scss" scoped>
  36. </style>