diff --git a/frontend/src/components/login/Login.vue b/frontend/src/components/login/Login.vue new file mode 100644 index 0000000000000000000000000000000000000000..4a756267851d6f5a8deb03a211dfd84006e97146 --- /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>