useEffect(() => {
// Check if token exists
if (token && typeof token === "string") {
async function handleUpdate() {
try {
const response = await apiClient.get(`/auth/update-email?token=${token}`);
if (!response.error) {
{
// Update Session here
setSuccess(true);
redirect(callbackUrl || "/account");
}
} else {
!success && setError(response.error);
}
} catch (err) {
console.error("Error verifying email: ", err);
{
!success && setError("Internal server error");
}
}
}
handleUpdate();
} else {
!success && setErrorsetError("Invalid Token");
}
}, [token, callbackUrl]);
Thats my page
The page updates the user’s email, but when I go back to this URL which is set to only work if the current session has an session.user.email == null
, it still lets me access it, so how do I update the session so it knows email isnt null anymore?