Created
July 19, 2022 16:24
-
-
Save KolbySisk/592e04248d4ea45fc1e8632a8b49601d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
useEffect(() => { | |
const { data: authListener } = supabase.auth.onAuthStateChange(async (event, session) => { | |
await fetch('/api/set-auth-cookie', { | |
method: 'POST', | |
headers: new Headers({ 'content-Type': 'application/json' }), | |
body: JSON.stringify({ session, event }), | |
}); | |
}); | |
return () => { | |
authListener?.unsubscribe(); | |
}; | |
}, []); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment