Skip to content

Features/anna mandatory user info#35

Open
marker-sss wants to merge 3 commits intomainfrom
features/anna-mandatory-user-info
Open

Features/anna mandatory user info#35
marker-sss wants to merge 3 commits intomainfrom
features/anna-mandatory-user-info

Conversation

@marker-sss
Copy link
Collaborator

Description

If user hasn't filled out their personal info yet, they get redirected to the "user info" page. They can't go to the homepage, they'll get redirected. They also cannot type a url into the address bar. They can click on their profile and navigate those pages, though.

How to use

In order to change that, those client pages will need a prop called "infoFilled" and look like this

(client page)
const { status, data: sessionData } = useSession();
const router = useRouter();

useEffect(() => {
if (status === "authenticated" && sessionData?.user && !infoFilled) {
router.replace("/create-account/basic-info");
}
}, [status, sessionData, router, events]);

(server page)
const session = await auth();
const userId = session?.user?.id ?? null;

let infoFilled = true;

if (session?.user) {
const [user] = await db
.select()
.from(users)
.where(eq(users.id, session.user.id))
.limit(1);

if (user) {
  infoFilled = user.info_filled;
}

}

then use the prob infoFilled when calling the client page.

@marker-sss marker-sss requested a review from AgustinSV February 28, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant