Control logging button from pages kit
Hey team — right now in our app we’ve got a custom Cart that requires login before checkout. We can detect login state using fetch, but it’s a little fidgety since we’re basically listening for the signal rather than triggering it.
Is there any way for us to manually trigger the Passport login flow from a custom button inside our component (instead of relying on the person icon in the corner)?
Like an “onClick={() => passport.login()}”
or a hook from usePassport() would be ideal.
We just want a cleaner way to handle login so the Cart can control the flow directly.
Thanks 🙏
— 12inchapps
2 条回复
我们提供了 useSessionContext 来获取用户信息,检查登录状态,调起登录功能。
下面这个段伪代码可以参考:
Thank you this is perfect!