Calling the backend
We need to add the actual action on the “Download” button for each product. Clicking on the button triggers an API GET request to the Gadget backend, which, for now, only returns a message with the requested product ID.
Frontend code update
Section titled “Frontend code update”- Update the button of the grid product item in order to trigger the
downloadProductPdfmethod of the Alpine component. - The
downloadProductPdfmethod calls the App Proxy base URL/apps/brushfollowed by the API endpointproduct-downloadand the product ID as a parameter. - For now, handling the response is just a matter of simple logging.
Backend code update
Section titled “Backend code update”- Create a GET route accepting the
idrequest parameter. - Send a very simple response to validate we properly get the product id from the frontend request.