Forum Discussion

madhukar1100's avatar
9 years ago

How can we add kudos button in custom component

Hi,

 

I have created a custom component to list all the latest blog posts. I wanted to display Kudos button and kudos count for each post. 

 

Kindly help me with the code to add in the post.

    • madhukar1100's avatar
      madhukar1100
      Mentor

      Hi,

       

      I tried copy pasting the code that you have given, but it didnt worked.

       

      Can you help me to get the correct code that needs to be added.

      • kandulmadhu's avatar
        kandulmadhu
        Advisor

        Hi madhukar1100,

         

        To add kudos functionality in a custom component:

         

        Create a button in html and then on click of that button make an ajax call to

        " 'community-baseURL'/restapi/vc/messages/id/'message-id'/kudos/give "

        Before making this ajax call, you will have to validate whether the user is signed in, because anonymous user cannot give kudo to any post.

         

        This should work.

        Let me know if you face any issues in this approach.

         

        Regards,

        Madhu