Fix login redirect: push router immediately and skip SWR revalidation
After login, explicitly navigate to destination instead of relying on useEffect. Also skip SWR revalidation to prevent a race where the re-fetch overrides the mutated user data. Made-with: Cursor
This commit is contained in:
@@ -82,7 +82,8 @@ export default function Login({ destination = "/" }: { destination?: string }) {
|
||||
toast.success("You have been logged in!", {
|
||||
toastId: "login-successful",
|
||||
});
|
||||
mutateUser(response.data);
|
||||
mutateUser(response.data, { revalidate: false });
|
||||
router.push(destination);
|
||||
})
|
||||
.catch((e) => {
|
||||
if (e.response.status === 401) {
|
||||
|
||||
Reference in New Issue
Block a user