mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-01-20 20:01:22 +00:00
Got the go to Index Page to work on Post Page deletion
This commit is contained in:
parent
8d6e3794cf
commit
7e922fa0b0
@ -84,13 +84,9 @@ export default {
|
||||
}, 1000)
|
||||
},
|
||||
async confirm() {
|
||||
console.log('"confirm" was reached !!!')
|
||||
this.loading = true
|
||||
try {
|
||||
console.log('"confirmCallback" is: ', this.confirmCallback)
|
||||
await this.confirmCallback()
|
||||
// this.confirmCallback()
|
||||
console.log('"confirmCallback" was exec !!!')
|
||||
this.success = true
|
||||
setTimeout(() => {
|
||||
this.isOpen = false
|
||||
|
||||
@ -2,7 +2,7 @@ import gql from 'graphql-tag'
|
||||
|
||||
export default {
|
||||
methods: {
|
||||
async deletePostCallback(listPageType = true) {
|
||||
async deletePostCallback(postDisplayType = 'list') {
|
||||
try {
|
||||
var gqlMutation = gql`
|
||||
mutation($id: ID!) {
|
||||
@ -16,12 +16,13 @@ export default {
|
||||
variables: { id: this.post.id }
|
||||
})
|
||||
this.$toast.success(this.$t(`delete.contribution.success`))
|
||||
if (listPageType) {
|
||||
console.log('Emit "deletePost" !!!')
|
||||
this.$emit('deletePost')
|
||||
} else {
|
||||
console.log('Redirect to index !!!')
|
||||
this.$router.history.push('/') // Single page type: redirect to index
|
||||
switch (postDisplayType) {
|
||||
case 'list':
|
||||
this.$emit('deletePost')
|
||||
break
|
||||
default:
|
||||
this.$router.history.push('/') // Single page type: Redirect to index
|
||||
break
|
||||
}
|
||||
} catch (err) {
|
||||
this.$toast.error(err.message)
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
placement="bottom-end"
|
||||
resource-type="contribution"
|
||||
:resource="post"
|
||||
:callbacks="{ confirm: deletePostOptionsCallback, cancel: null }"
|
||||
:callbacks="{ confirm: () => deletePostCallback('page'), cancel: null }"
|
||||
:is-owner="isAuthor(post.author.id)"
|
||||
/>
|
||||
</no-ssr>
|
||||
@ -256,9 +256,6 @@ export default {
|
||||
methods: {
|
||||
isAuthor(id) {
|
||||
return this.$store.getters['auth/user'].id === id
|
||||
},
|
||||
async deletePostOptionsCallback() {
|
||||
await deletePostCallback(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user