apple signin NEXT-AUTH redirects to home page after success

Viewed 181
return await signIn("apple", {
                  redirect: false,
                  callbackUrl: window.location.href,
                });

Once I sign in through apple I get redirect to / page. When I do the same with facebook sign in I get redirect to where I want to. What I want is to redirect a user on certain conditions once ones logged in

  useEffect(() => {
    if (
      session &&
      session?.has_subscription &&
      !Storage.get("withcode")
    ) {
      router?.push(PAGE.SETTINGS);
    }

    if (
      session &&
      !session?.has_subscription &&
      !Storage.has("withcode")
    ) {
      router?.push(PAGE.CHOOSE_PLAN);
    }

    if (session && Storage.get("withcode")) {
      router?.push(PAGE.DISCOUNT);
      Storage.remove("withcode");
    }
  }, [router, session]);
0 Answers
Related