Skip to content

Commit

Permalink
fix: add prefilled details from firebase data (#240)
Browse files Browse the repository at this point in the history
fix: add prefilled details from firebase
  • Loading branch information
ayussh-2 authored Nov 3, 2024
1 parent 7a58807 commit c55adf3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/app/register/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import { userSchema } from '@/config/zodd/userDetailsSchema';
import { AuthContext } from '@/context/auth-context';
import { REGISTER_ORG } from '@/graphql/mutations/organizationMutations';
import { REGISTER_USER } from '@/graphql/mutations/userMutations';
import { GET_USER_BY_UID } from '@/graphql/queries/userQueries';
import { useIsLoggedIn } from '@/hooks/useIsLoggedIn';
import { useUserDetails } from '@/hooks/useUserDetails';
import handleLoadingAndToast from '@/utils/handleLoadingToast';
import { uploadToCloudinary } from '@/utils/uploadToCloudinary';
import { useMutation, useSuspenseQuery } from '@apollo/client';
import { GET_USER_BY_UID } from '@/graphql/queries/userQueries';

import {
DisclaimerPara,
Expand Down Expand Up @@ -301,6 +301,16 @@ function Page() {
}

const userCookie = Cookies.get('userDataDB');
const userGoogleData = Cookies.get('userData');

if (userGoogleData) {
const googleData = JSON.parse(userGoogleData);
setUserDetails((prev) => ({
...prev,
name: googleData.name.toUpperCase(),
email: googleData.email,
}));
}
const hasUserData = userDataDB?.user?.data?.length > 0;
const userData = hasUserData ? userDataDB.user.data[0] : null;
const isNitR = userData?.college === nitrID;
Expand Down

0 comments on commit c55adf3

Please sign in to comment.