Skip to content
Snippets Groups Projects
Commit 970cf0eb authored by 최지원's avatar 최지원
Browse files

Add user authentication

parent d3fa04fa
No related branches found
No related tags found
1 merge request!27Add user authentication
<template> <template>
<v-container fill-height fluid grid-list-xl> <v-container fill-height fluid grid-list-xl>
<v-layout justify-center wrap> <v-layout justify-center wrap>
<v-dialog
v-model="loginDialog"
persistent
max-width="290"
>
<v-card>
<v-card-title class="headline">불러오기 실패</v-card-title>
<v-card-text>
로그인이 필요한 기능입니다.
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="green darken-1"
text
@click="moveLogin"
>
로그인 이동
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-flex xs12 md8> <v-flex xs12 md8>
<material-card color="green" v-bind:title="findpost.title" v-bind:text="findpost.created" display-2> <material-card color="green" v-bind:title="findpost.title" v-bind:text="findpost.created" display-2>
<v-card :elevation="20" width="300" :shaped="true" v-if="dataLoading" class="mx-auto"> <v-card :elevation="20" width="300" :shaped="true" v-if="dataLoading" class="mx-auto">
...@@ -192,9 +216,12 @@ ...@@ -192,9 +216,12 @@
<script> <script>
export default { export default {
created: function () { created: function () {
if(this.$store.commit('getToken')){
const _id = this.$route.params._id; const _id = this.$route.params._id;
this.$http.get(`/finderboard/${_id}`) this.$http.get(`/finderboard/${_id}`)
.then((response) => { .then((response) => {
this.dataLoading = true; this.dataLoading = true;
this.findpost = response.data.board; this.findpost = response.data.board;
this.items = this.findpost.comments; this.items = this.findpost.comments;
...@@ -202,6 +229,10 @@ export default { ...@@ -202,6 +229,10 @@ export default {
this.image='data:image/jpeg;base64,'+base64data; this.image='data:image/jpeg;base64,'+base64data;
this.dataLoading = false; this.dataLoading = false;
}); });
}
else{
this.loginDialog = true;
}
}, },
data: () => { data: () => {
return{ return{
...@@ -222,6 +253,7 @@ export default { ...@@ -222,6 +253,7 @@ export default {
commentSnackbar: false, commentSnackbar: false,
postSnackbar: false, postSnackbar: false,
comment_id: '', comment_id: '',
loginDialog: false,
dataLoading: true dataLoading: true
} }
}, },
...@@ -306,6 +338,10 @@ export default { ...@@ -306,6 +338,10 @@ export default {
this.$router.push({ this.$router.push({
path:`/modifyfindpost/${item_id}` path:`/modifyfindpost/${item_id}`
}) })
},
moveLogin: function(){
this.loginDialog = false;
this.$router.push(`/login`);
} }
}, },
} }
......
<template> <template>
<v-container fill-height fluid grid-list-xl> <v-container fill-height fluid grid-list-xl>
<v-layout justify-center wrap> <v-layout justify-center wrap>
<v-dialog
v-model="loginDialog"
persistent
max-width="290"
>
<v-card>
<v-card-title class="headline">불러오기 실패</v-card-title>
<v-card-text>
로그인이 필요한 기능입니다.
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="green darken-1"
text
@click="moveLogin"
>
로그인 이동
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-flex xs12 md8> <v-flex xs12 md8>
<material-card color="green" v-bind:title="lostpost.title" v-bind:text="lostpost.created"> <material-card color="green" v-bind:title="lostpost.title" v-bind:text="lostpost.created">
<v-card :elevation="20" width="300" :shaped="true" v-if="dataLoading" class="mx-auto"> <v-card :elevation="20" width="300" :shaped="true" v-if="dataLoading" class="mx-auto">
...@@ -188,7 +212,9 @@ ...@@ -188,7 +212,9 @@
<script> <script>
export default { export default {
created: function () { created: function () {
if(this.$store.commit('getToken')){
const _id = this.$route.params._id; const _id = this.$route.params._id;
this.$http.get(`/losterboard/${_id}`) this.$http.get(`/losterboard/${_id}`)
.then((response) => { .then((response) => {
this.dataLoading = true; this.dataLoading = true;
...@@ -198,6 +224,10 @@ export default { ...@@ -198,6 +224,10 @@ export default {
this.image='data:image/jpeg;base64,'+base64data; this.image='data:image/jpeg;base64,'+base64data;
this.dataLoading = false; this.dataLoading = false;
}); });
}
else{
this.loginDialog = true;
}
}, },
data: () => { data: () => {
return{ return{
...@@ -219,6 +249,7 @@ export default { ...@@ -219,6 +249,7 @@ export default {
commentSnackbar: false, commentSnackbar: false,
postSnackbar: false, postSnackbar: false,
comment_id: '', comment_id: '',
loginDialog: false,
dataLoading: true, dataLoading: true,
} }
}, },
...@@ -298,6 +329,10 @@ export default { ...@@ -298,6 +329,10 @@ export default {
this.postSnackbar = true; this.postSnackbar = true;
} }
this.postDeleteDialog = false; this.postDeleteDialog = false;
},
moveLogin: function(){
this.loginDialog = false;
this.$router.push(`/login`);
} }
}, },
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment