Replies: 1 comment 1 reply
-
Hi, take a look at #371 please. Simplest way is to use: // Export this function in a separate file, so you can use it where needed
export const reloadSession = () => {
const event = new Event("visibilitychange");
document.dispatchEvent(event);
}; // Do some stuff when submitting form, update the stuff in database and then call the function above
const onSubmit = async (data) => {
await fetch("/api/update", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
reloadSession();
}; Next Auth uses an event listener |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Ok say im logged in and i update my avatar or profile_pic how do i reload the session to get the new data from the backend and have them in my sessions object?
Beta Was this translation helpful? Give feedback.
All reactions