Rename confirm callbacks

This commit is contained in:
Wolfgang Huß 2019-05-19 07:42:55 +02:00
parent 388e9ff6b2
commit 2016a9445b
8 changed files with 10 additions and 18 deletions

View File

@ -20,7 +20,7 @@
placement="bottom-end"
resource-type="comment"
:resource="comment"
:callbacks="{ confirmCallback, cancelCallback: null }"
:callbacks="{ confirm: deleteCommentCallback, cancel: null }"
style="float-right"
:is-owner="isAuthor(author.id)"
/>
@ -72,9 +72,7 @@ export default {
isAuthor(id) {
return this.user.id === id
},
async confirmCallback() {
console.log('"confirmCallback" was called !!! ', this.comment.id)
async deleteCommentCallback() {
try {
// XXX Make custom mutation and tests in the Backend !!!
var gqlMutation = gql`

View File

@ -18,8 +18,8 @@
v-if="open === 'delete'"
:id="data.resource.id"
:type="data.type"
:confirm-callback="data.callbacks.confirmCallback"
:cancel-callback="!!data.callbacks.cancelCallback ? data.callbacks.cancelCallback : null"
:confirmCallback="data.callbacks.confirm"
:cancelCallback="!!data.callbacks.cancel ? data.callbacks.cancel : null"
:name="name"
@close="close"
/>

View File

@ -67,7 +67,7 @@
<content-menu
resource-type="contribution"
:resource="post"
:callbacks="{ confirmCallback, cancelCallback: null }"
:callbacks="{ confirm: deletePostCallback, cancel: null }"
:is-owner="isAuthor"
/>
</no-ssr>

View File

@ -2,7 +2,7 @@ import gql from 'graphql-tag'
export default {
methods: {
async confirmCallback() {
async deletePostCallback() {
try {
var gqlMutation = gql`
mutation($id: ID!) {

View File

@ -87,11 +87,10 @@ export default {
})
},
deletePost(_index, postId) {
console.log('Pages/index.vue: Post item deleted !!!')
this.Post = this.Post.filter((post) => {
return post.id !== postId
})
// Ideal sulution:
// Ideal solution:
// this.Post.splice(index, 1)
}
},

View File

@ -18,7 +18,7 @@
placement="bottom-end"
resource-type="contribution"
:resource="post"
:callbacks="{ confirmCallback, cancelCallback: null }"
:callbacks="{ confirm: deletePostCallback, cancel: null }"
:is-owner="isAuthor(post.author.id)"
/>
</no-ssr>

View File

@ -38,8 +38,8 @@
<hc-post-card
v-for="(relatedPost, index) in post.relatedContributions"
:key="relatedPost.id"
:width="{ base: '100%', lg: 1 }"
:post="relatedPost"
:width="{ base: '100%', lg: 1 }"
@delete="deletePost(index)"
/>
</ds-flex>
@ -75,7 +75,6 @@ export default {
},
methods: {
deletePost(index) {
console.log('Post/more-info.vue: Post item deleted !!!')
this.post.relatedContributions.splice(index, 1)
}
},

View File

@ -25,7 +25,7 @@
placement="bottom-end"
resource-type="user"
:resource="user"
:callbacks="{ confirmCallback, cancelCallback: null }"
:callbacks="{ confirm: deletePostCallback, cancel: null }"
:is-owner="myProfile"
class="user-content-menu"
/>
@ -404,9 +404,6 @@ export default {
throw new Error('User not found!')
}
}
// activePosts(activePosts) {
// this.activePosts = activePosts || []
// }
},
methods: {
uniq(items, field = 'id') {
@ -440,7 +437,6 @@ export default {
},
deletePost(index) {
this.user.contributions.splice(index, 1)
// this.$router.history.push('/')
}
},
apollo: {