is there a way to restrict/limit PATCH request with axios?

Viewed 75

Using nuxt + strapi with its strapi-plugin-comments, I'd like to restrict logged users so they can only like/dislike comments once;

code here:

methods: {
  async likeComment(commentId) {
    try {

      await this.$axios.$patch(
        `${this.$config.baseURL}/comments/post:${this.contentId}/comment/${commentId}/like`,
        {
          headers: {
            Authorization: `Bearer ${this.$auth.$storage.getUniversal(
              'jwt'
            )}`,
          },
        }
      )
      this.$toast.success('Thank you for your input!').goAway(5000)
      window.location.reload(true)
    } catch (e) {
      this.$toast.error(e).goAway(5000)
    }
  },
}

Is there a way to restrict that PATCH request?

0 Answers
Related