Skip to content

Commit c62d84e

Browse files
testing/logging onboarding pages
1 parent d7b2e13 commit c62d84e

File tree

5 files changed

+19
-3
lines changed

5 files changed

+19
-3
lines changed

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ export function UserOnboardingFlow({
4141
setCurrentStep(flowStates[currentIndex + 1]);
4242
}
4343
}, [currentStep, flowStates]);
44+
console.log('flowStates : ', flowStates);
4445

4546
useEffect(() => {
4647
if (currentStep === "COMPLETE") {
48+
console.log('currentStep is COMPLETE', currentStep);
49+
console.log('onboardingStatus : ', onboardingStatus);
50+
console.log('now redirecting to /dashboard');
4751
replace("/dashboard");
4852
}
4953
}, [currentStep, replace]);
@@ -54,7 +58,7 @@ export function UserOnboardingFlow({
5458
exit: { opacity: 0, y: -50 },
5559
};
5660

57-
console.log(currentStep)
61+
console.log('currentStep in OnboardingFlow : ', currentStep)
5862

5963
return (
6064
<AnimatePresence mode="wait">

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ export function OrganizationCreation({ onSuccess }: OrganizationCreationProps) {
3434
toast({ title: "Organization created!", description: "Your new organization is ready." });
3535
onSuccess();
3636
},
37-
onError: () => {
37+
onError: (error) => {
38+
console.log('Failed to create organization. reason : ', error);
3839
toast({ title: "Failed to create organization", description: "Please try again.", variant: "destructive" });
3940
},
4041
});
4142

4243
const onSubmit = (data: CreateOrganizationSchema) => {
43-
console.log('submitting');
44+
console.log('submitting data : ', data);
4445
createOrgMutation.mutate(data);
4546
};
4647

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

+4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ export function ProfileUpdate({
3333
const updateProfileMutation = useMutation({
3434
mutationFn: () => updateUserProfileNameAndAvatar({ fullName, avatarUrl }, { isOnboardingFlow: true }),
3535
onSuccess: () => {
36+
console.log('Profile updated!');
3637
toast({ title: "Profile updated!", description: "Your profile has been successfully updated." });
3738
onSuccess();
3839
},
3940
onError: () => {
41+
console.log('Failed to update profile');
4042
toast({ title: "Failed to update profile", description: "Please try again.", variant: "destructive" });
4143
},
4244
});
@@ -50,10 +52,12 @@ export function ProfileUpdate({
5052
onSuccess: (response) => {
5153
if (response.status === 'success') {
5254
setAvatarUrl(response.data);
55+
console.log('Avatar uploaded!');
5356
toast({ title: "Avatar uploaded!", description: "Your new avatar has been set." });
5457
}
5558
},
5659
onError: () => {
60+
console.log('Failed to upload avatar');
5761
toast({ title: "Error uploading avatar", description: "Please try again.", variant: "destructive" });
5862
},
5963
});

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

+2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ export function TermsAcceptance({ onSuccess }: TermsAcceptanceProps) {
1414
const acceptTermsMutation = useMutation({
1515
mutationFn: () => acceptTermsOfService(true),
1616
onSuccess: () => {
17+
console.log('Terms accepted!');
1718
toast({ title: "Terms accepted!", description: "Welcome aboard!" });
1819
onSuccess();
1920
},
2021
onError: () => {
22+
console.log('Failed to accept terms');
2123
toast({ title: "Failed to accept terms", description: "Please try again.", variant: "destructive" });
2224
},
2325
});

src/middleware.ts

+5
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,15 @@ export async function middleware(req: NextRequest) {
8585
// user is possibly logged in, but lets validate session
8686
const user = await supabase.auth.getUser();
8787
if (user.error) {
88+
console.log('user is not logged in. reason : ', user.error);
8889
return NextResponse.redirect(toSiteURL('/login'));
8990
}
9091
}
9192
if (!isUnprotectedPage(req.nextUrl.pathname) && !maybeUser) {
93+
console.log(
94+
'protected page but user is not logged in. reason : ',
95+
maybeUser,
96+
);
9297
return NextResponse.redirect(toSiteURL('/login'));
9398
}
9499
if (

0 commit comments

Comments
 (0)