diff --git a/app/onboarding/page.tsx b/app/onboarding/page.tsx index 2a93dd0..502bdf6 100644 --- a/app/onboarding/page.tsx +++ b/app/onboarding/page.tsx @@ -4,12 +4,6 @@ import React, { useState } from 'react'; import { upsertProfile } from '@/api/supabase/queries/profiles'; import { Profile } from '@/types/schema'; -type UUID = `${string}-${string}-${string}-${string}-${string}`; -const generateUUID = (): UUID => { - return crypto.randomUUID() as UUID; -}; -const id = generateUUID(); - // Define the possible options for each question const states = ['Tennessee', 'Missouri']; const gardenTypes = ['Individual', 'Community', 'School']; @@ -124,20 +118,19 @@ const OnboardingFlow = () => { const handleSubmit = async () => { const profile: Profile = { - user_id: id, + user_id: '2abd7296-374a-42d1-bb4f-b813da1615ae', state: selectedState, - email: '', - phone_num: '', user_type: selectedGardenType, has_plot: selectedPlot, }; try { - const updatedProfile = await upsertProfile(profile); - console.log('Profile successfully upserted:', updatedProfile); - } catch (err) { - console.error('Error upserting profile:', err); + upsertProfile(profile); + } catch (error) { + console.error('Error upserting profile:', error); + throw new Error('Error upserting profile'); } finally { } + //TODO: Remove console log. console.log('Submitted data: ', profile); // Handle form submission, e.g., send to a server or display a confirmation }; diff --git a/types/schema.d.ts b/types/schema.d.ts index 6b7e3f5..b6c22a5 100644 --- a/types/schema.d.ts +++ b/types/schema.d.ts @@ -5,8 +5,6 @@ export type Season = 'SPRING' | 'SUMMER' | 'FALL' | 'WINTER'; export interface Profile { user_id: UUID; state: string; - email: string; - phone_num: string; user_type: string; has_plot: boolean; } diff --git a/utils/ProfileProvider.tsx b/utils/ProfileProvider.tsx new file mode 100644 index 0000000..e5339ad --- /dev/null +++ b/utils/ProfileProvider.tsx @@ -0,0 +1,3 @@ +'use client'; + +import { createContext } from 'react';