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

F5 Error Resolve!

parent 30b4eb27
Branches
No related tags found
1 merge request!21F5 Error Resolve!
...@@ -122,6 +122,7 @@ export default { ...@@ -122,6 +122,7 @@ export default {
if(res.data.success==true){ if(res.data.success==true){
this.$store.commit("setInitialize"); this.$store.commit("setInitialize");
this.$store.commit('delToken'); this.$store.commit('delToken');
this.$store.commit('delu_ID');
} }
}) })
} }
......
...@@ -30,5 +30,12 @@ export default { ...@@ -30,5 +30,12 @@ export default {
delToken (state) { delToken (state) {
localStorage.removeItem('token') localStorage.removeItem('token')
state.token = null state.token = null
},
getu_ID (state) {
state.u_ID = localStorage.getItem('u_ID')
},
delu_ID (state) {
localStorage.removeItem('u_ID')
state.u_ID = null
} }
} }
...@@ -11,5 +11,6 @@ export default { ...@@ -11,5 +11,6 @@ export default {
live: "", live: "",
}, },
token: localStorage.getItem('token'), token: localStorage.getItem('token'),
u_ID: localStorage.getItem('u_ID'),
isUserInfoGetted: false //유저 정보가 현재 사용 가능한지 나타내는 플래그 변수 isUserInfoGetted: false //유저 정보가 현재 사용 가능한지 나타내는 플래그 변수
} }
...@@ -69,7 +69,9 @@ export default { ...@@ -69,7 +69,9 @@ export default {
}; };
this.$store.commit("setUserInfo", payload); this.$store.commit("setUserInfo", payload);
localStorage.setItem('token', user._id) localStorage.setItem('token', user._id)
localStorage.setItem('u_ID', user.ID)
this.$store.commit('getToken'); this.$store.commit('getToken');
this.$store.commit('getu_ID');
// alert(this.$store.state.userInfo._id) // alert(this.$store.state.userInfo._id)
this.$router.push('/'); this.$router.push('/');
} }
......
...@@ -201,7 +201,7 @@ export default { ...@@ -201,7 +201,7 @@ export default {
console.log("Token : " + localStorage.getItem('token')) console.log("Token : " + localStorage.getItem('token'))
console.log("User_id : " + this.$store.state.userInfo._id); console.log("User_id : " + this.$store.state.userInfo._id);
if(this.$store.state.userInfo._id != localStorage.getItem('token')){ if(!localStorage.getItem('token')){
this.loginDialog = true; this.loginDialog = true;
} }
else{ else{
......
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
<v-layout justify-center wrap> <v-layout justify-center wrap>
<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-form> <v-card :elevation="20" width="300" :shaped="true" v-if="dataLoading" class="mx-auto">
<v-card-text>
<strong class="display-3 center">LOADING....</strong>
</v-card-text>
</v-card>
<v-form v-if="!dataLoading">
<v-container py-0> <v-container py-0>
<v-layout wrap column> <v-layout wrap column>
<v-flex xs12 md4> <v-flex xs12 md4>
...@@ -55,7 +60,7 @@ ...@@ -55,7 +60,7 @@
<v-divider vertical></v-divider> <v-divider vertical></v-divider>
<v-btn <v-btn
small small
v-if="$store.state.userInfo.ID === item.id" v-if="$store.state.u_ID === item.id"
color="error" color="error"
dark dark
@click.stop="commentDeleteDialog = true, comment_id = item._id" @click.stop="commentDeleteDialog = true, comment_id = item._id"
...@@ -118,13 +123,13 @@ ...@@ -118,13 +123,13 @@
class="mx-0 font-weight-light" class="mx-0 font-weight-light"
color="success" color="success"
@click="onPostChange(findpost._id)" @click="onPostChange(findpost._id)"
v-if="$store.state.userInfo.ID === findpost.id" v-if="$store.state.u_ID === findpost.id"
>게시글 수정</v-btn> >게시글 수정</v-btn>
<v-divider vertical></v-divider> <v-divider vertical></v-divider>
<v-btn <v-btn
color="error" color="error"
dark dark
v-if="$store.state.userInfo.ID === findpost.id" v-if="$store.state.u_ID === findpost.id"
@click.stop="postDeleteDialog = true" @click.stop="postDeleteDialog = true"
> >
게시글 삭제 게시글 삭제
...@@ -190,10 +195,12 @@ export default { ...@@ -190,10 +195,12 @@ export default {
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.findpost = response.data.board; this.findpost = response.data.board;
this.items = this.findpost.comments; this.items = this.findpost.comments;
var base64data=Buffer.from(this.findpost.image.data.data,'binary').toString('base64'); var base64data=Buffer.from(this.findpost.image.data.data,'binary').toString('base64');
this.image='data:image/jpeg;base64,'+base64data; this.image='data:image/jpeg;base64,'+base64data;
this.dataLoading = false;
}); });
}, },
data: () => { data: () => {
...@@ -214,7 +221,8 @@ export default { ...@@ -214,7 +221,8 @@ export default {
commentDeleteDialog: false, commentDeleteDialog: false,
commentSnackbar: false, commentSnackbar: false,
postSnackbar: false, postSnackbar: false,
comment_id: '' comment_id: '',
dataLoading: true
} }
}, },
methods:{ methods:{
......
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
<v-layout justify-center wrap> <v-layout justify-center wrap>
<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-form> <v-card :elevation="20" width="300" :shaped="true" v-if="dataLoading" class="mx-auto">
<v-card-text>
<strong class="display-3 center">LOADING....</strong>
</v-card-text>
</v-card>
<v-form v-if="!dataLoading">
<v-container py-0> <v-container py-0>
<v-layout wrap column> <v-layout wrap column>
<v-flex xs12 md4> <v-flex xs12 md4>
...@@ -50,7 +55,7 @@ ...@@ -50,7 +55,7 @@
<td class="text-xs-right" outlined>{{ item.created }}</td> <td class="text-xs-right" outlined>{{ item.created }}</td>
<v-divider vertical></v-divider> <v-divider vertical></v-divider>
<v-btn <v-btn
v-if="$store.state.userInfo.ID === item.id" v-if="$store.state.u_ID === item.id"
small small
color="error" color="error"
dark dark
...@@ -114,13 +119,13 @@ ...@@ -114,13 +119,13 @@
class="mx-0 font-weight-light" class="mx-0 font-weight-light"
color="success" color="success"
@ @
v-if="$store.state.userInfo.ID === lostpost.id" v-if="$store.state.u_ID === lostpost.id"
>게시글 수정</v-btn> >게시글 수정</v-btn>
<v-divider vertical></v-divider> <v-divider vertical></v-divider>
<v-btn <v-btn
color="error" color="error"
dark dark
v-if="$store.state.userInfo.ID === lostpost.id" v-if="$store.state.u_ID === lostpost.id"
@click.stop="postDeleteDialog = true" @click.stop="postDeleteDialog = true"
> >
게시글 삭제 게시글 삭제
...@@ -186,10 +191,12 @@ export default { ...@@ -186,10 +191,12 @@ export default {
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.lostpost = response.data.board; this.lostpost = response.data.board;
this.items = this.lostpost.comments; this.items = this.lostpost.comments;
var base64data=Buffer.from(this.lostpost.image.data.data,'binary').toString('base64'); var base64data=Buffer.from(this.lostpost.image.data.data,'binary').toString('base64');
this.image='data:image/jpeg;base64,'+base64data; this.image='data:image/jpeg;base64,'+base64data;
this.dataLoading = false;
}); });
}, },
data: () => { data: () => {
...@@ -211,7 +218,8 @@ export default { ...@@ -211,7 +218,8 @@ export default {
commentDeleteDialog: false, commentDeleteDialog: false,
commentSnackbar: false, commentSnackbar: false,
postSnackbar: false, postSnackbar: false,
comment_id: '' comment_id: '',
dataLoading: true,
} }
}, },
methods:{ methods:{
...@@ -248,7 +256,7 @@ export default { ...@@ -248,7 +256,7 @@ export default {
const comment_idx = this.comment_id; const comment_idx = this.comment_id;
const post_idx = this.$route.params._id; const post_idx = this.$route.params._id;
const user_id = this.$store.state.userInfo.ID; const user_id = this.$store.state.u_ID;
const index = this.items.findIndex(function(item, i){ const index = this.items.findIndex(function(item, i){
return item._id === comment_idx return item._id === comment_idx
...@@ -275,7 +283,7 @@ export default { ...@@ -275,7 +283,7 @@ export default {
onPostDelete: function(id){ onPostDelete: function(id){
const post_id = id; const post_id = id;
const user_id = this.$store.state.userInfo._id; const user_id = this.$store.state.userInfo._id;
const user_ID = this.$store.state.userInfo.ID; const user_ID = this.$store.state.u_ID;
const post_writer_ID = this.lostpost.id; const post_writer_ID = this.lostpost.id;
if(user_ID === post_writer_ID){ if(user_ID === post_writer_ID){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment