Skip to content

Commit

Permalink
fixed conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
philipye315 committed Oct 9, 2024
2 parents 4f9ffac + 833a7e4 commit 9389d96
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
2 changes: 0 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 44 additions & 2 deletions src/SeekHelp/index.tsx
Original file line number Diff line number Diff line change
@@ -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 <Text>SEEK HELP!</Text>;
const [summaries, setSummaries] = useState<Resource[]>([]);

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 (
<View>
<Button title="Fetch Data" onPress={fetchData} />
{summaries.length > 0 ? (
summaries.map((resource, index) => (
<Text key={index}>{resource.summary}</Text>
))
) : (
<Text>Loading...</Text>
)}
</View>
);
}

0 comments on commit 9389d96

Please sign in to comment.