From 8b9cbdfc0f567878ebc2d5aad01d31e7b0588638 Mon Sep 17 00:00:00 2001 From: gibbyb Date: Mon, 21 Oct 2024 10:49:20 -0500 Subject: [PATCH] Fixed some new errors. Cleaned up console logs --- components/auth/SignInScreen.tsx | 7 +------ components/home/RequestRelationship.tsx | 2 -- components/home/UserInfo.tsx | 1 - components/services/SecureStore.tsx | 6 +++++- constants/APIs.ts | 3 +-- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/components/auth/SignInScreen.tsx b/components/auth/SignInScreen.tsx index 681b299..e2555b0 100644 --- a/components/auth/SignInScreen.tsx +++ b/components/auth/SignInScreen.tsx @@ -30,14 +30,9 @@ const SignInScreen = ({onSignIn}: {onSignIn: () => void}) => { const pushToken = await Notifications.getExpoPushTokenAsync({ projectId: projectId, }); - console.log( - credential.user, credential.email, credential.fullName?.givenName, - credential.fullName?.familyName, pushToken.data - ); - + const initialDataResponse = await getInitialDataByAppleId(credential.user); - console.log(initialDataResponse); if (initialDataResponse.status === 404 || !initialDataResponse.ok) { if (!credential.user || !credential.email || !credential.fullName?.givenName || !credential.fullName?.familyName || diff --git a/components/home/RequestRelationship.tsx b/components/home/RequestRelationship.tsx index 2242d54..763f485 100644 --- a/components/home/RequestRelationship.tsx +++ b/components/home/RequestRelationship.tsx @@ -39,9 +39,7 @@ const RequestRelationship: } const user = await getUser() as User; setIsLoading(true); - console.log(user.id, encodeURIComponent(term)); const users: User[] = await searchUsers(user.id, encodeURIComponent(term)) as User[]; - console.log(users); setSearchResults(users); setIsLoading(false); }, 300), []); diff --git a/components/home/UserInfo.tsx b/components/home/UserInfo.tsx index 59192da..d180070 100644 --- a/components/home/UserInfo.tsx +++ b/components/home/UserInfo.tsx @@ -19,7 +19,6 @@ const UserInfo: React.FC = ({ onPfpUpdate }) => { try { const user: User = await getUser() as User; setUser(user); - console.log(`${process.env.EXPO_PUBLIC_API_URL}${user.pfpUrl}`); if (user.pfpUrl) onPfpUpdate(user.pfpUrl); } catch (error) { diff --git a/components/services/SecureStore.tsx b/components/services/SecureStore.tsx index b1477dc..ea74b3a 100644 --- a/components/services/SecureStore.tsx +++ b/components/services/SecureStore.tsx @@ -131,13 +131,17 @@ export const saveInitialData = async (initialData: InitialData) => { try { await SecureStore.setItemAsync('user', JSON.stringify(initialData.user)); if (initialData.relationshipData) { + console.log('Saving relationship data to SecureStore...'); + console.log('Relationship:', initialData.relationshipData.relationship); await SecureStore.setItemAsync( 'relationship', JSON.stringify(initialData.relationshipData.relationship) ); + console.log('Partner:', initialData.relationshipData.partner); await SecureStore.setItemAsync( 'partner', JSON.stringify(initialData.relationshipData.partner) ); - await SecureStore.setItemAsync('countdown', JSON.stringify(initialData.countdown)); + if (initialData.countdown) + await SecureStore.setItemAsync('countdown', JSON.stringify(initialData.countdown)); } } catch (error) { console.error('Error saving initial data to SecureStore:', error); diff --git a/constants/APIs.ts b/constants/APIs.ts index 19c5375..38b8c6d 100644 --- a/constants/APIs.ts +++ b/constants/APIs.ts @@ -100,7 +100,7 @@ export const updateProfilePicture = async (userId: number, pfpUrl: string) => { export const checkRelationshipStatus = async (userId: number) => { try { - const apiUrl = `${process.env.EXPO_PUBLIC_API_URL}/api/users/checkRelationship`; + const apiUrl = `${process.env.EXPO_PUBLIC_API_URL}/api/relationships/checkStatus`; const response = await fetch((apiUrl + `?userId=${userId}`), { headers: { 'x-api-key': process.env.EXPO_PUBLIC_API_KEY ?? '', @@ -190,5 +190,4 @@ export const sendRelationshipRequest = async (userId: number, targetUserId: numb console.error('Error sending Relationship request:', error); throw error; } - };