How to handle favoriting errors? Answered
Hey! I made the save favorites functionality. Works perfectly. I am trying to build a save list that only shows the saved items. It shows the exact number but does not show the info. I am loading it in a collection list. Thanks
Comments
7 comments
Pozdrav 😄
Is this what you're trying to do?
https://webflow.com/made-in-webflow/website/filter-saved-cms-items
Can these saves be shown on a dedicated page? Or only on the page they are saved on? https://www.memberstack.com/scripts/like-unlike-cms-items
Hey, I asked yesterday the same. Put the collection list on any page and follow this
https://webflow.com/made-in-webflow/website/filter-saved-cms-items
Thanks
Hi everyone,
I’m using the following script in Webflow to allow users to favorite and unfavorite collection items. It works flawlessly for logged-in users, but I’m encountering an issue with non-logged-in users experiencing errors.
Here’s the error message:
It seems that the script is trying to accessÂ
getMemberJSON()
 for users who are not logged in, which results in a 401 Unauthorized error. Ideally, the script should only load the favorite/unfavorite functionality for logged-in users and not attempt to load for non-logged-in users.I’ve tried several approaches but haven’t found a solution that works. Is there an efficient way to identify if a user is logged in to Memberstack before attempting to run the script? Any help or suggestions would be greatly appreciated!
Thanks in advance!Script:
He Bartosz Chlebowicz, could you share your site where I can test this as a logged out user?
The memberscript should have taken care of this by default, as if you check the project demo, logged out users can only see the CMS without the feature of saving / unsaving.
So having a look at your site might help in troubleshooting the issue faster.
I was testing the script you shared in personal dummy site and I made a slight change to the code via which now logged out members can't see any error in the console which you shared.
Just replace this line of code in checkMemberLogin() function:
to the following line:
I have tested this in my site and logged in users can save / unsave items as usual, additionally logged out-users do not have any error in the console regarding this feature. Hope this helps.
Hi, I managed to fix it! Thank you.
Please sign in to leave a comment.