From a37beeadcc5f2bceccdde641b8b90da0b702dc78 Mon Sep 17 00:00:00 2001
From: YongJae <sdc689@gmail.com>
Date: Sun, 24 Nov 2019 21:01:14 +0900
Subject: [PATCH] Add front - Login.vue

---
 frontend/src/components/login/Login.vue | 48 +++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 frontend/src/components/login/Login.vue

diff --git a/frontend/src/components/login/Login.vue b/frontend/src/components/login/Login.vue
new file mode 100644
index 0000000..4a75626
--- /dev/null
+++ b/frontend/src/components/login/Login.vue
@@ -0,0 +1,48 @@
+<template>
+  <div id="login">
+    <div>Login</div>
+    <input v-model="user.id" placeholder="ID" /> <br />
+    <input v-model="user.password" type="password" placeholder="password" />
+    <button v-on:click="login">login</button>
+    <a v-bind:href="url.signUpUrl"> Sign up </a>
+  </div>
+</template>
+
+<script>
+export default {
+  data: function() {
+    return {
+      user: {
+        id: "",
+        password: ""
+      },
+      url: {
+        signUpUrl: "/login/signUp"
+      }
+    };
+  },
+  methods: {
+    login: function(event) {
+      console.log("login start");
+      this.$http
+        .post("/api/login/checkLogin", {
+          user: this.user
+        })
+
+        .then(
+          response => {
+            //로그인 성공
+            alert("success login");
+          },
+          error => {
+            // error 를 보여줌
+            alert(error.response.data.error);
+          }
+        )
+        .catch(error => {
+          alert(error);
+        });
+    }
+  }
+};
+</script>
-- 
GitLab