Skip to content
Snippets Groups Projects
Commit 5f0d1e11 authored by LeeYongJae's avatar LeeYongJae
Browse files

Login with session2

parent 1aea2c9c
No related branches found
No related tags found
No related merge requests found
......@@ -6,15 +6,13 @@
<span class="md-title">MajorBook</span>
</div>
<div style="flex:1">
<div align="right">
<div v-if="!checkLoggedIn">
<Login />
<SignUp />
</div>
<div v-if="checkLoggedIn">
<Logout />
</div>
<div style="flex:1; height:20px" align="right">
<div v-if="isLoggedIn === false">
<Login />
<SignUp />
</div>
<div v-else>
<Logout />
</div>
</div>
......@@ -22,11 +20,7 @@
<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>
......@@ -63,25 +57,25 @@ export default {
},
methods: {
checkSession() {
this.$http.get("/api/login/checkSession").then(function(response) {
//console.log(response.data);
this.$http.get("/api/login/checkSession").then(response => {
console.log(response.data);
if (response.data === true) {
return true;
return (this.isLoggedIn = true);
} 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>
......
......@@ -13,10 +13,8 @@
<md-input v-model="user.password" type="password" />
</md-field>
<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-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-dialog>
</div>
</template>
......@@ -27,6 +25,7 @@ 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 {
......@@ -50,6 +49,7 @@ export default {
alert("success login");
//this.$router.push("Logout");
this.active = false;
location.reload();
},
error => {
// error 를 보여줌
......
......@@ -20,7 +20,9 @@ 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();
}
});
}
......
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