diff --git a/backend/routes/login.js b/backend/routes/login.js index 18dbe7722fbe11d5cdc0024696d86554e711ab27..66a879e238c63e1acb3671d3c114a2dc89409bfb 100644 --- a/backend/routes/login.js +++ b/backend/routes/login.js @@ -43,12 +43,11 @@ router.get("/logout", function(req, res) { if (err) { console.log(err); } else { - console.log("Hello"); - res.redirect("http://localhost:8081/"); // �섏젙�댁빞 �� �� + res.redirect("/"); // �섏젙�댁빞 �� �� } }); } else { - res.redirect("http://localhost:8081/"); + res.redirect("/"); } }); diff --git a/frontend/src/App.vue b/frontend/src/App.vue index fad2cdde1f702bc1010581d635291206bfd8820e..ff7e97505fa6a5d357060fd50f214ad8ed8e71a5 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -6,13 +6,15 @@ <span class="md-title">MajorBook</span> </div> - <div style="flex:1; height:20px" align="right"> - <div v-if="isLoggedIn === false"> - <Login /> - <SignUp /> - </div> - <div v-else> - <Logout /> + <div style="flex:1"> + <div align="right"> + <div v-if="!checkLoggedIn"> + <Login /> + <SignUp /> + </div> + <div v-if="checkLoggedIn"> + <Logout /> + </div> </div> </div> @@ -20,7 +22,11 @@ <md-tabs class="md-primary" style="margin: auto; height: 30px"> <md-tab id="tab-home" md-label="Home" to="/home"></md-tab> <md-tab id="tab-profile" md-label="Profile" to="/profile"></md-tab> - <md-tab id="tab-list" md-label="�꾧났�쒖쟻蹂닿린" to="/BookSearchPage"></md-tab> + <md-tab + id="tab-list" + md-label="�꾧났�쒖쟻蹂닿린" + to="/BookSearchPage" + ></md-tab> </md-tabs> </div> </md-app-toolbar> @@ -57,26 +63,25 @@ export default { }, methods: { checkSession() { - this.$http.get("/api/login/checkSession").then(response => { - console.log(response.data); + this.$http.get("/api/login/checkSession").then(function(response) { + //console.log(response.data); if (response.data === true) { - return (this.isLoggedIn = true); - //this.$router.push("home"); + return true; } else { - return (this.isLoggedIn = false); + return false; } }); } + }, + computed: { + checkLoggedIn() { + console.log(this.checkSession()); + if (this.checkSession() === true) { + return true; + } + return false; + } } - // computed: { - // checkLoggedIn() { - // console.log(this.checkSession()); - // if (this.checkSession() === true) { - // return (this.isLoggedIn = true); - // } - // return (this.isLoggedIn = false); - // } - // } }; </script> diff --git a/frontend/src/components/BookSearchPage.vue b/frontend/src/components/BookSearchPage.vue index 9e8d1e3342606eb7dc23c40e7ae1bf2b77ac3700..fa52caf4f77a6b5eb315946c216fbecd1447f322 100644 --- a/frontend/src/components/BookSearchPage.vue +++ b/frontend/src/components/BookSearchPage.vue @@ -33,18 +33,18 @@ <md-card-header> <md-card-header-text> <div class="md-title"> - {{ Book.title }} + {{Book.title}} <br /> <br /> </div> <div class="md-subhead" style="text-align:left;font-weight: bold;"> - # �숇뀈: {{ Book.grade }} + # �숇뀈: {{Book.grade}} <br /> - # �꾧났: {{ Book.major }} + # �꾧났: {{Book.major}} <br /> - # �몃��ы빆: {{ Book.type }} + # �몃��ы빆: {{Book.type}} <br /> - # 留ㅻЪ: {{ Book.stock }} + # 留ㅻЪ: {{Book.stock}} </div> </md-card-header-text> <md-card-media md-medium> @@ -96,85 +96,98 @@ </div> </template> + + <script> -import Vue from "vue"; -import VueMaterial from "vue-material"; -import Multiselect from "vue-multiselect"; -import "vue-material/dist/vue-material.min.css"; -import "vue-material/dist/theme/default.css"; -Vue.use(VueMaterial); +import Vue from 'vue' +import VueMaterial from 'vue-material' +import Multiselect from 'vue-multiselect' +import 'vue-material/dist/vue-material.min.css' +import 'vue-material/dist/theme/default.css' +Vue.use(VueMaterial) export default { - components: { Multiselect }, - name: "MaterialIcons", - data() { - return { - bottomPosition: "md-bottom-right", - active: false, - SearchResult: false, - grade: null, - major: null, - type: null, - option1: ["1�숇뀈", "2�숇뀈", "3�숇뀈", "4�숇뀈"], - option2: ["�뚰봽�몄썾�댄븰怨�", "誘몃뵒�댄븰怨�", "寃쎌젣�숆낵"], - option3: ["�꾧났 �꾩닔", "�꾧났 �좏깮", "援먯뼇�좏깮", "湲곗큹怨쇰ぉ"], - Books: [], - submit: { - title: "", - grade: "", - major: "", - src: "" - } - }; - }, - created() { - this.$http.get("/api/books").then(response => { - this.Books = response.data; - console.log("Success"); - console.log(this.Books); - }); - }, - methods: { - Search: function() { - if (this.grade !== null && this.major !== null && this.type !== null) { - this.SearchResult = true; - console.log(this.SearchResult); - } else { - alert("寃��됲븷 移댄뀒怨좊━瑜� �꾨� �낅젰�댁<�몄슂"); - } + components: { Multiselect }, + name: 'MaterialIcons', + data() { + return { + bottomPosition: 'md-bottom-right', + active : false, + SearchResult : false, + grade: null, + major: null, + type: null, + option1: ['1�숇뀈','2�숇뀈','3�숇뀈','4�숇뀈'], + option2: ['�뚰봽�몄썾�댄븰怨�','誘몃뵒�댄븰怨�','寃쎌젣�숆낵'], + option3: ['�꾧났 �꾩닔', '�꾧났 �좏깮', '援먯뼇�좏깮','湲곗큹怨쇰ぉ'], + Books : [ + ], + submit:{ + title : "", + grade: "", + major : "", + src : "", + } + }; }, - Register() { - this.$http - .post("/api/books", this.submit) - .then(res => { - console.log("Sumit Success"); - }) - .catch(err => { - console.log("Submit failed"); - }); - this.active = false; + created() { + this + .$http + .get('/api/books') + .then(response => { + this.Books = response.data; + console.log("Success") + console.log(this.Books) + }) + }, + methods:{ + Search: function(){ + if(this.grade !== null && this.major !== null && this.type !== null) + { + this.SearchResult = true; + console.log(this.SearchResult); + } + else + { + alert("寃��됲븷 移댄뀒怨좊━瑜� �꾨� �낅젰�댁<�몄슂") + } + + }, + Register(){ + this.$http + .post("/api/books", this.submit) + .then(res => { + console.log("Sumit Success"); + }) + .catch(err => { + console.log("Submit failed"); + }); + this.active = false; } - } +} }; </script> -<style lang="css"> -html, -body { - text-align: center; - margin: 0; - width: 100%; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; - justify-content: center; + +<style lang='css'> +html,body { + text-align: center; + margin:0; + width:100%; + font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; + justify-content: center; + } .search { - margin-bottom: 0.5%; + margin-Bottom: 0.5%; } .select { - text-align: center; - margin-top: 2%; + + text-align: center; + margin-Top: 2%; } -.button { - margin-top: 70px; +.button{ + margin-top: 70px; } </style> -<style src="vue-multiselect/dist/vue-multiselect.min.css"></style> +<style src="vue-multiselect/dist/vue-multiselect.min.css"> +</style> \ No newline at end of file diff --git a/frontend/src/components/login/Login.vue b/frontend/src/components/login/Login.vue index 9d27c96a941bea1b2f663017007b7e7af519d7c4..4ace51f26052827a18a4aeb1d810a42e4106d70e 100644 --- a/frontend/src/components/login/Login.vue +++ b/frontend/src/components/login/Login.vue @@ -13,8 +13,10 @@ <md-input v-model="user.password" type="password" /> </md-field> - <md-button class="md-raised md-primary" v-on:click="login">Login</md-button> - <md-button class="md-primary" v-on:click="active = false">Close</md-button> + <md-button class="md-primary" v-on:click="login">Login</md-button> + <md-button class="md-primary" v-on:click="active = false" + >Close</md-button + > </md-dialog> </div> </template> @@ -25,7 +27,6 @@ import VueMaterial from "vue-material"; import "vue-material/dist/vue-material.min.css"; import "vue-material/dist/theme/default.css"; Vue.use(VueMaterial); - export default { data: function() { return { @@ -49,7 +50,6 @@ export default { alert("success login"); //this.$router.push("Logout"); this.active = false; - location.reload(); }, error => { // error 瑜� 蹂댁뿬以� diff --git a/frontend/src/components/login/Logout.vue b/frontend/src/components/login/Logout.vue index 025fa9cb4a38180871272d7d7b2d7108b72f8510..a76e5d29636c1226790977494f8567d2724450ca 100644 --- a/frontend/src/components/login/Logout.vue +++ b/frontend/src/components/login/Logout.vue @@ -20,9 +20,7 @@ export default { console.log("Logout start"); this.$http.get("/api/login/logout").then(response => { if (response) { - alert("success logout"); //this.$router.push("home"); - location.reload(); } }); } diff --git a/frontend/src/components/login/SignUp.vue b/frontend/src/components/login/SignUp.vue index 0dba42e7767ac575260cc56259d11056341f750a..a7118e3575df16c42d80ab83a3b81410576b072f 100644 --- a/frontend/src/components/login/SignUp.vue +++ b/frontend/src/components/login/SignUp.vue @@ -1,5 +1,5 @@ <template> - <div id="signup"> + <div id="logout"> <md-button class="md-primary" v-on:click="active = true">Sign Up</md-button> <md-dialog :md-active.sync="active" style="width:500px; height: 1000px"> <md-dialog-title>Sign Up</md-dialog-title> @@ -23,13 +23,17 @@ <md-input name="email" v-model="user.email" /> </md-field> - <md-button class="md-raised md-primary" v-on:click="signUp">Sign Up</md-button> - <md-button class="md-primary" v-on:click="active = false">Close</md-button> + <md-button class="md-raised md-primary" v-on:click="signUp" + >Sign Up</md-button + > + <md-button class="md-primary" v-on:click="active = false" + >Close</md-button + > </md-dialog> </div> </template> -<style scoped> +<style> .select { margin: 15px; display: inline-flex;