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

Merge branch 'F5-error' into 'master'

F5 Error Resolve!

See merge request !21
parents d0d122a2 9fa5ec05
No related branches found
No related tags found
1 merge request!21F5 Error Resolve!
......@@ -122,6 +122,7 @@ export default {
if(res.data.success==true){
this.$store.commit("setInitialize");
this.$store.commit('delToken');
this.$store.commit('delu_ID');
}
})
}
......
......@@ -30,5 +30,12 @@ export default {
delToken (state) {
localStorage.removeItem('token')
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 {
live: "",
},
token: localStorage.getItem('token'),
u_ID: localStorage.getItem('u_ID'),
isUserInfoGetted: false //유저 정보가 현재 사용 가능한지 나타내는 플래그 변수
}
......@@ -69,7 +69,9 @@ export default {
};
this.$store.commit("setUserInfo", payload);
localStorage.setItem('token', user._id)
localStorage.setItem('u_ID', user.ID)
this.$store.commit('getToken');
this.$store.commit('getu_ID');
// alert(this.$store.state.userInfo._id)
this.$router.push('/');
}
......
......@@ -201,7 +201,7 @@ export default {
console.log("Token : " + localStorage.getItem('token'))
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;
}
else{
......
......@@ -3,7 +3,12 @@
<v-layout justify-center wrap>
<v-flex xs12 md8>
<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-layout wrap column>
<v-flex xs12 md4>
......@@ -55,7 +60,7 @@
<v-divider vertical></v-divider>
<v-btn
small
v-if="$store.state.userInfo.ID === item.id"
v-if="$store.state.u_ID === item.id"
color="error"
dark
@click.stop="commentDeleteDialog = true, comment_id = item._id"
......@@ -118,13 +123,13 @@
class="mx-0 font-weight-light"
color="success"
@click="onPostChange(findpost._id)"
v-if="$store.state.userInfo.ID === findpost.id"
v-if="$store.state.u_ID === findpost.id"
>게시글 수정</v-btn>
<v-divider vertical></v-divider>
<v-btn
color="error"
dark
v-if="$store.state.userInfo.ID === findpost.id"
v-if="$store.state.u_ID === findpost.id"
@click.stop="postDeleteDialog = true"
>
게시글 삭제
......@@ -190,10 +195,12 @@ export default {
const _id = this.$route.params._id;
this.$http.get(`/finderboard/${_id}`)
.then((response) => {
this.dataLoading = true;
this.findpost = response.data.board;
this.items = this.findpost.comments;
var base64data=Buffer.from(this.findpost.image.data.data,'binary').toString('base64');
this.image='data:image/jpeg;base64,'+base64data;
this.dataLoading = false;
});
},
data: () => {
......@@ -214,7 +221,8 @@ export default {
commentDeleteDialog: false,
commentSnackbar: false,
postSnackbar: false,
comment_id: ''
comment_id: '',
dataLoading: true
}
},
methods:{
......
......@@ -3,7 +3,12 @@
<v-layout justify-center wrap>
<v-flex xs12 md8>
<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-layout wrap column>
<v-flex xs12 md4>
......@@ -50,7 +55,7 @@
<td class="text-xs-right" outlined>{{ item.created }}</td>
<v-divider vertical></v-divider>
<v-btn
v-if="$store.state.userInfo.ID === item.id"
v-if="$store.state.u_ID === item.id"
small
color="error"
dark
......@@ -114,13 +119,13 @@
class="mx-0 font-weight-light"
color="success"
@
v-if="$store.state.userInfo.ID === lostpost.id"
v-if="$store.state.u_ID === lostpost.id"
>게시글 수정</v-btn>
<v-divider vertical></v-divider>
<v-btn
color="error"
dark
v-if="$store.state.userInfo.ID === lostpost.id"
v-if="$store.state.u_ID === lostpost.id"
@click.stop="postDeleteDialog = true"
>
게시글 삭제
......@@ -186,10 +191,12 @@ export default {
const _id = this.$route.params._id;
this.$http.get(`/losterboard/${_id}`)
.then((response) => {
this.dataLoading = true;
this.lostpost = response.data.board;
this.items = this.lostpost.comments;
var base64data=Buffer.from(this.lostpost.image.data.data,'binary').toString('base64');
this.image='data:image/jpeg;base64,'+base64data;
this.dataLoading = false;
});
},
data: () => {
......@@ -211,7 +218,8 @@ export default {
commentDeleteDialog: false,
commentSnackbar: false,
postSnackbar: false,
comment_id: ''
comment_id: '',
dataLoading: true,
}
},
methods:{
......@@ -248,7 +256,7 @@ export default {
const comment_idx = this.comment_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){
return item._id === comment_idx
......@@ -275,7 +283,7 @@ export default {
onPostDelete: function(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.u_ID;
const post_writer_ID = this.lostpost.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