diff --git a/data.mv.db b/data.mv.db index 76cf63e..3be22bd 100644 Binary files a/data.mv.db and b/data.mv.db differ diff --git a/front/vue_front/src/App.vue b/front/vue_front/src/App.vue index f90d2ef..06e0f21 100644 --- a/front/vue_front/src/App.vue +++ b/front/vue_front/src/App.vue @@ -4,7 +4,6 @@

- Профили Лента Выход

diff --git a/front/vue_front/src/components/Comment.vue b/front/vue_front/src/components/Comment.vue index ac82608..2b32f7e 100644 --- a/front/vue_front/src/components/Comment.vue +++ b/front/vue_front/src/components/Comment.vue @@ -18,6 +18,8 @@

Вы вошли как: {{ selectedProfileLogin }}

+ Админ-панель +
Лента
@@ -158,7 +149,8 @@
@@ -183,7 +175,8 @@ export default { selectedPostText: '', textModal: '', selectedCommentId: 0, - textFinder: '' + textFinder: '', + isAdminFlag: false } }, methods: { @@ -283,12 +276,18 @@ export default { }, async createComment() { - await axios.post('http://localhost:8080/api/1.0/comment/?text=' + this.textModal + '&ownerId=' + this.selectedProfileId + '&postId=' + this.selectedPostId, - { + // await axios.post('http://localhost:8080/api/1.0/comment/?text=' + this.textModal + '&ownerId=' + this.selectedProfileId + '&postId=' + this.selectedPostId, + // { + // headers: { + // 'Authorization':'Bearer ' + localStorage.token + // } + // }); + await fetch('http://localhost:8080/api/1.0/comment/?text=' + this.textModal + '&ownerId=' + this.selectedProfileId + '&postId=' + this.selectedPostId, { + method: 'POST', headers: { - 'Authorization': 'Bearer ' + localStorage.token - } - }); + 'Authorization':'Bearer ' + localStorage['token'] + }, + }) this.refreshList(); }, async deleteComment(commentId) { @@ -302,12 +301,20 @@ export default { this.refreshList(); }, async editComment(){ - await axios.put('http://localhost:8080/api/1.0/comment/' + this.selectedCommentId + '?text=' + this.textModal, - { + // await axios.put('http://localhost:8080/api/1.0/comment/' + this.selectedCommentId + '?text=' + this.textModal, + // { + // headers: { + // 'Authorization': 'Bearer ' + localStorage.token + // } + // }); + + await fetch('http://localhost:8080/api/1.0/comment/' + this.selectedCommentId + '?text=' + this.textModal, { + method: 'PUT', headers: { - 'Authorization': 'Bearer ' + localStorage.token - } - }); + 'Authorization':'Bearer ' + localStorage['token'] + }, + }) + this.refreshList(); }, async refreshList(){ @@ -335,12 +342,20 @@ export default { }); }, async createPost() { - const response = await axios.post('http://localhost:8080/api/api/1.0/post/?text=' + this.textModal + '&authorId=' + this.selectedProfileId, - { + console.log('Authorization '+ 'Bearer ' + localStorage['token']) + // const response = await axios.post('http://localhost:8080/api/1.0/post/?text=' + this.textModal + '&authorId=' + this.selectedProfileId, + // { + // headers: { + // 'Authorization': 'Bearer ' + localStorage['token'] + // } + // }); + await fetch('http://localhost:8080/api/1.0/post/?text=' + this.textModal + '&authorId=' + this.selectedProfileId, { + method: 'POST', headers: { - 'Authorization': 'Bearer ' + localStorage.token - } - }); + 'Authorization':'Bearer ' + localStorage['token'] + }, + }) + this.refreshList(); }, @@ -374,6 +389,19 @@ export default { ) } + var a = await axios.get('http://localhost:8080/api/1.0/profile/role/' + localStorage.token, + { + headers: { + 'Authorization': 'Bearer ' + localStorage.token + } + } + ) + console.log('role') + console.log(a.data) + if (a.data == 'ADMIN'){ + this.isAdminFlag = true + } + const responseProfile = await axios.get('http://localhost:8080/api/1.0/profile/', { diff --git a/src/main/resources/templates/profiles.html b/src/main/resources/templates/profiles.html index 0552194..8dce0b9 100644 --- a/src/main/resources/templates/profiles.html +++ b/src/main/resources/templates/profiles.html @@ -7,10 +7,6 @@
- -