Like button
"I am a noob" and would like to know the process on the Xano side to
create a variable for my Like button. So I can connected to Bravo and bind it to my app. If there is any advice or tutorials I would greatly appreciate it
Comments
-
While I did this for my site on Webflow, there are aps that do this but maybe not with Xano. It takes a bit of JavaScript and probably depends on your front end. I started with this video
to address the performance issues that arise with a plethora of opportunities to "make a favorite."
It took ME a while to get it working but start a JavaScript editor and mimic his code.
If you get that far reach out and I'll share what I did. -
you can examine the photo sharing template, which has this functionality. Basically, you want to create a "like" table which references the item being liked and the user_id who is liking it. Creating a like would simply be adding a record to this table.
-
Here's some content from a recent office hours on this topic:
-
I did a two-part series on favoriting a product with Xano and AppGyver. It is about one year old so some things in Xano have changed but I think it applies pretty directly still…
AppGyver & Xano (Favorites Feature - Part 1): Building a favorites feature for a user's product listhttps://youtu.be/O4GY1xKASL8
AppGyver & Xano (Favorites Feature - Part 2): Building a favorites feature for a user's product listhttps://youtu.be/Aj1mgSkFgh0
-
Thank you I found this tutorial useful
-
@Steve Stava Thank you for this tutorial! May I ask you how can I query the list in order to let the authenticated user to see only his favorite items? (eg. if he has only 2 favorite items, to return only that 2 items).
-
I will give this a shot at a high-level. I don't have the project in Xano anymore so I can't test what I am offering here :)
- Do a query all records against the list of favorites (the xref table of user & product). Filter on the auth.id that is available on authenticated APIs. That will give you a list of all of that user's favorited products.
- Add a Join to that same query all records. Join to the product table so you can get the product information that you will most likely want to display in your UI. To have that info show up in the response of the query you need to do a couple of things.
- Go to the Output tab in the query function you just built. Go all the way to the bottom and select "Evals" and then add an item ("+"). In the drop down you will see the list of fields for the two tables you have Joined. Pick the fields from the Product table that you want returned in the query
- Now, go to the Customize button on the Output tab and make sure that the new fields you selected in Evals are selected in Customize so they get returned with the query results
I think this should get you there. Let me know what happens! (Thanks for watching my videos!!)
-
Thanks a lot, @Steve Stava !
I just tried your suggestion and everything looks good until I add the Evals. After I add the evals the query filter db:likes.users_id == auth:id is ignored and the entire list is returned again. Any idea why?
After I add the evals tradespeople.name as tradespeople_name
-
I don’t think I mentioned in my comment to have a filter in your join clause that specifies to match on trades people ID from the trade people table to be equal to the trade people ID from the favorites table that was selected
-
@Steve Stava Absolute legend! Many many thanks! It works great.
-
I am happy I could help. Enjoy the rest of your build!
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback