From 833a7e46ffe34a4d207ebfc926e51ea465711fb0 Mon Sep 17 00:00:00 2001 From: user Date: Tue, 8 Oct 2024 19:23:25 -0700 Subject: [PATCH] displaying summaries --- src/SeekHelp/index.tsx | 46 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/src/SeekHelp/index.tsx b/src/SeekHelp/index.tsx index 5e3b31b..172549b 100644 --- a/src/SeekHelp/index.tsx +++ b/src/SeekHelp/index.tsx @@ -1,5 +1,47 @@ -import { Text } from 'react-native'; +import React, { useEffect, useState } from 'react'; +import { Button, Text, View } from 'react-native'; +import supabase from '../supabase/createClient'; + +interface Resource { + summary: string; + [key: string]: any; +} export default function SeekHelp() { - return SEEK HELP!; + const [summaries, setSummaries] = useState([]); + + useEffect(() => { + fetchData(); + }, []); + + const fetchData = async () => { + try { + const { data, error } = await supabase + .from('state_resources') + .select('*') + .in('state', ['California', 'National']); + + if (error) { + console.error('Error fetching resources:', error); + return; + } + + setSummaries(data as Resource[]); + } catch (error) { + console.error('Error fetching data:', error); + } + }; + + return ( + +