Skip to content

Commit

Permalink
remove comments and simplify fetchPlants
Browse files Browse the repository at this point in the history
  • Loading branch information
ccatherinetan committed Oct 21, 2024
1 parent 87bcf03 commit 7a07486
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions app/view-plants/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,11 @@ import { Plant } from '@/types/schema';

export default function Home() {
const [result, setResult] = useState<Plant>();
async function fetchPlant(state: string, id: UUID) {
const plant = await getPlantById(state, id);
console.log(plant);
return plant;
}
// const plant: Plant = {
// id: '3067b896-ba05-45b0-bb5c-e09277cf1e68',
// plant_name: 'tomato',
// state: 'tennessee',
// harvest_season: 'SPRING',
// water_num_times_per_week: 7,
// plant_seed_indoors_start: 'January',
// plant_seed_indoors_end: 'February',
// plant_seed_outdoors_start: 'March',
// plant_seed_outdoors_end: 'April',
// plant_transplant_start: 'April',
// plant_transplant_end: 'May',
// harvest_start: 'April',
// harvest_end: 'May',
// water_inches_per_week: 7,
// harvest_days_after_plant: 5,
// sunlight_required: 'Yes',
// beginner_friendly: true,
// plant_tips: 'aerg',
// };
useEffect(() => {
const getData = async () => {
const testState: string = 'Tennessee';
const testUUID: UUID = '43c19f80-8205-4d03-b323-05c220550bf0';
const plant2 = await fetchPlant(testState, testUUID);
const testUUID: UUID = '185a3300-b0fc-4383-8fb4-417737d77659';
const plant2 = await getPlantById(testState, testUUID);
setResult(plant2); // Set the result to state
};

Expand All @@ -48,11 +23,4 @@ export default function Home() {
} else {
return <PlantCard plant={result} />;
}
// return (
// <div>

// <PlantCard plant={plant}/>
//
// </div>
// );
}

0 comments on commit 7a07486

Please sign in to comment.