AddAccount.vue 569 B

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