vue3-google-login
vue3-google-login copied to clipboard
Close OneTapPopup when loggedIn from another method.
I am using OneTapPopup (in main layout file) and Google button (on Login Page).
If I login from Google Login button on Login page. OneTapPopup keep displaying on the top right corner. I want to hide the oneTapPopup when I log in to the application from any other method.
@Usman-Ejaz If you are using GoogleLogin
component, once user is logged in, add any conditional logic to prevent it from rendering, once logged in you don't need to use this component, rendering it will show up On-Tap prompt. Or simply use googleOneTap
method which will give you more control when to show up the prompt.
Hi @devbaji,
Thank you for your response! I appreciate your suggestion to use conditional logic or the googleOneTap
method. However, I'm still a bit unclear on how to implement this. Could you please provide a more detailed explanation and a concrete example?
Specifically, I want to understand:
- How to use conditional logic to prevent the OneTapPopup from rendering once the user is logged in.
- How to use the
googleOneTap
method to control when the prompt appears and disappears.
Here is my current setup:
- I have the
OneTapPopup
component in my main layout file. - I have a Google Login button on the Login page.
- When the user logs in using the Google Login button, the OneTapPopup still appears on the top right corner, which I want to hide.
Any code snippets or detailed steps would be very helpful.
Thank you!
@ram-you You might have some state in client side like isLoggedIn or something like that, based on this you need to render the component for example
<GoogleLogin v-if="!isLoggedIn" :callback="callback" />
This will avoid rendering the component once the user is logged in. Or just only include the component inside your login component rather than the main layout which is shared by all pages.
Or use googleOneTap
method, which can be invoked only when needed, maybe inside you onMount logic of login component
I am closing this issue as this is a logic that needed to handled on dev side and not a plugin issue