Skip to content

Commit

Permalink
Updated Profile Schema, removed some console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin3656 committed Oct 23, 2024
1 parent adf0c22 commit 9e892c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
19 changes: 6 additions & 13 deletions app/onboarding/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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
};
Expand Down
2 changes: 0 additions & 2 deletions types/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions utils/ProfileProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use client';

import { createContext } from 'react';

Check failure on line 3 in utils/ProfileProvider.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint, Prettier, and TypeScript compiler

'createContext' is defined but never used

Check failure on line 3 in utils/ProfileProvider.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint, Prettier, and TypeScript compiler

'createContext' is defined but never used

0 comments on commit 9e892c6

Please sign in to comment.