Create a Like button which appearance changes based on the following states:
The heart and spinner icons are provided for your convenience. The focus of this question is on the handling of the various states, not so much on being pixel perfect. As for colors, you can use #f00
for the red and #888
for the gray.
https://www.greatfrontend.com/api/questions/like-button
POST
json
The following fields are accepted in the request body:
action
: A string of either 'like'
or 'unlike'
depending on the desired action.The API has a 50% chance of succeeding (HTTP 200) or failing (HTTP 500) so as to make it easy for you to test the request failure cases. It returns a JSON payload of the following shape depending on the outcome.
{ message: 'Success!' }
{ message: 'Unknown error during attempted {{action}}. Please try again later.!' }
Create a Like button which appearance changes based on the following states:
The heart and spinner icons are provided for your convenience. The focus of this question is on the handling of the various states, not so much on being pixel perfect. As for colors, you can use #f00
for the red and #888
for the gray.
https://www.greatfrontend.com/api/questions/like-button
POST
json
The following fields are accepted in the request body:
action
: A string of either 'like'
or 'unlike'
depending on the desired action.The API has a 50% chance of succeeding (HTTP 200) or failing (HTTP 500) so as to make it easy for you to test the request failure cases. It returns a JSON payload of the following shape depending on the outcome.
{ message: 'Success!' }
{ message: 'Unknown error during attempted {{action}}. Please try again later.!' }
console.log()
aparecerão aqui.