Skip to content
Snippets Groups Projects
Commit 272dc6e5 authored by LeeYongJae's avatar LeeYongJae
Browse files

Merge branch 'login_with_session2' into 'master'

Login with session2

See merge request !15
parents 1aea2c9c 5f0d1e11
No related branches found
No related tags found
1 merge request!15Login with session2
...@@ -6,15 +6,13 @@ ...@@ -6,15 +6,13 @@
<span class="md-title">MajorBook</span> <span class="md-title">MajorBook</span>
</div> </div>
<div style="flex:1"> <div style="flex:1; height:20px" align="right">
<div align="right"> <div v-if="isLoggedIn === false">
<div v-if="!checkLoggedIn"> <Login />
<Login /> <SignUp />
<SignUp /> </div>
</div> <div v-else>
<div v-if="checkLoggedIn"> <Logout />
<Logout />
</div>
</div> </div>
</div> </div>
...@@ -22,11 +20,7 @@ ...@@ -22,11 +20,7 @@
<md-tabs class="md-primary" style="margin: auto; height: 30px"> <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-home" md-label="Home" to="/home"></md-tab>
<md-tab id="tab-profile" md-label="Profile" to="/profile"></md-tab> <md-tab id="tab-profile" md-label="Profile" to="/profile"></md-tab>
<md-tab <md-tab id="tab-list" md-label="전공서적보기" to="/BookSearchPage"></md-tab>
id="tab-list"
md-label="전공서적보기"
to="/BookSearchPage"
></md-tab>
</md-tabs> </md-tabs>
</div> </div>
</md-app-toolbar> </md-app-toolbar>
...@@ -63,25 +57,25 @@ export default { ...@@ -63,25 +57,25 @@ export default {
}, },
methods: { methods: {
checkSession() { checkSession() {
this.$http.get("/api/login/checkSession").then(function(response) { this.$http.get("/api/login/checkSession").then(response => {
//console.log(response.data); console.log(response.data);
if (response.data === true) { if (response.data === true) {
return true; return (this.isLoggedIn = true);
} else { } else {
return false; return (this.isLoggedIn = 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 true;
// }
// return false;
// }
// }
}; };
</script> </script>
......
...@@ -13,10 +13,8 @@ ...@@ -13,10 +13,8 @@
<md-input v-model="user.password" type="password" /> <md-input v-model="user.password" type="password" />
</md-field> </md-field>
<md-button class="md-primary" v-on:click="login">Login</md-button> <md-button class="md-raised md-primary" v-on:click="login">Login</md-button>
<md-button class="md-primary" v-on:click="active = false" <md-button class="md-primary" v-on:click="active = false">Close</md-button>
>Close</md-button
>
</md-dialog> </md-dialog>
</div> </div>
</template> </template>
...@@ -27,6 +25,7 @@ import VueMaterial from "vue-material"; ...@@ -27,6 +25,7 @@ import VueMaterial from "vue-material";
import "vue-material/dist/vue-material.min.css"; import "vue-material/dist/vue-material.min.css";
import "vue-material/dist/theme/default.css"; import "vue-material/dist/theme/default.css";
Vue.use(VueMaterial); Vue.use(VueMaterial);
export default { export default {
data: function() { data: function() {
return { return {
...@@ -50,6 +49,7 @@ export default { ...@@ -50,6 +49,7 @@ export default {
alert("success login"); alert("success login");
//this.$router.push("Logout"); //this.$router.push("Logout");
this.active = false; this.active = false;
location.reload();
}, },
error => { error => {
// error 를 보여줌 // error 를 보여줌
......
...@@ -20,7 +20,9 @@ export default { ...@@ -20,7 +20,9 @@ export default {
console.log("Logout start"); console.log("Logout start");
this.$http.get("/api/login/logout").then(response => { this.$http.get("/api/login/logout").then(response => {
if (response) { if (response) {
alert("success logout");
//this.$router.push("home"); //this.$router.push("home");
location.reload();
} }
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment