Skip to content

Commit 63c4adf

Browse files
testing github auth
1 parent c62d84e commit 63c4adf

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/app/(dynamic-pages)/(authenticated-pages)/onboarding/OnboardingFlow.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function UserOnboardingFlow({
3333
getInitialFlowState(flowStates, onboardingStatus)
3434
);
3535

36-
const { replace } = useRouter();
36+
const router = useRouter();
3737

3838
const nextStep = useCallback(() => {
3939
const currentIndex = flowStates.indexOf(currentStep);
@@ -48,9 +48,9 @@ export function UserOnboardingFlow({
4848
console.log('currentStep is COMPLETE', currentStep);
4949
console.log('onboardingStatus : ', onboardingStatus);
5050
console.log('now redirecting to /dashboard');
51-
replace("/dashboard");
51+
router.push("/dashboard");
5252
}
53-
}, [currentStep, replace]);
53+
}, [currentStep, router, onboardingStatus]);
5454

5555
const cardVariants = {
5656
hidden: { opacity: 0, y: 50 },

src/data/user/user.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,10 @@ export async function setOnboardingStatus(): Promise<
292292
},
293293
});
294294

295+
console.log('updateAuthUser : ', updateAuthUser);
296+
295297
if (updateAuthUser.error) {
298+
console.log('Failed to update onboarding status. reason : ', updateAuthUser.error);
296299
return {
297300
status: "error",
298301
message: updateAuthUser.error.message,
@@ -302,6 +305,7 @@ export async function setOnboardingStatus(): Promise<
302305
const refreshSessionResponse = await supabaseClient.auth.refreshSession();
303306

304307
if (refreshSessionResponse.error) {
308+
console.log('Failed to refresh session. reason : ', refreshSessionResponse.error);
305309
return {
306310
status: "error",
307311
message: refreshSessionResponse.error.message,

src/middleware.ts

+9
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,17 @@ export async function middleware(req: NextRequest) {
7777
const supabase = createMiddlewareClient<Database>({ req, res });
7878
const sessionResponse = await supabase.auth.getSession();
7979
const maybeUser = sessionResponse?.data.session?.user;
80+
console.log(
81+
'Checking if user should be onboarded:',
82+
req.nextUrl.pathname,
83+
maybeUser,
84+
);
8085
if (shouldOnboardUser(req.nextUrl.pathname, maybeUser)) {
8186
console.log('redirecting to onboarding');
87+
console.log(
88+
'shouldOnboardUser result:',
89+
shouldOnboardUser(req.nextUrl.pathname, maybeUser),
90+
);
8291
return NextResponse.redirect(toSiteURL('/onboarding'));
8392
}
8493
if (!isUnprotectedPage(req.nextUrl.pathname) && maybeUser) {

0 commit comments

Comments
 (0)