Skip to content

Commit

Permalink
filter by state
Browse files Browse the repository at this point in the history
  • Loading branch information
SashankBalusu committed Oct 26, 2024
1 parent 35b9ff6 commit 29b49c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/view-plants/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function Page() {
const [plants, setPlants] = useState<Plant[]>([]);
const [userPlants, setUserPlants] = useState<Plant[]>([]);
const user_id: UUID = 'e72af66d-7aae-45f6-935a-187197749d9f';
const userState = 'TENNESSEE';
async function fetchUserPlants(user_id: UUID) {
const { data, error } = await supabase
.from('user_plants')
Expand All @@ -38,7 +39,8 @@ export default function Page() {
useEffect(() => {
const fetchPlantSeasonality = async () => {
const plantList = await getAllPlants();
setPlants(plantList);
const result = plantList.filter(plant => plant.us_state === userState);
setPlants(result);
};

fetchPlantSeasonality();
Expand Down

0 comments on commit 29b49c8

Please sign in to comment.