Throw error if the user is not the owner of the post while edit

This commit is contained in:
Grzegorz Leoniec 2019-02-04 17:36:52 +01:00
parent 37a81d59e5
commit 63925e4046
No known key found for this signature in database
GPG Key ID: 3AA43686D4EB1377

View File

@ -25,6 +25,9 @@ export default {
if (!this.Post || !this.Post[0].id) {
return
}
if (this.Post[0].author.id !== this.$store.getters['auth/user'].id) {
throw new Error(`You can't edit that!`)
}
return this.Post[0]
}
},
@ -40,6 +43,9 @@ export default {
createdAt
slug
image
author {
id
}
tags {
name
}