Skip to content

Commit

Permalink
fixed client initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
stephaniewong2 committed Oct 11, 2023
1 parent e4d6a0a commit 8385da3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
26 changes: 15 additions & 11 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ module.exports = api => {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: ['expo-router/babel',
["module:react-native-dotenv", {
"envName": "APP_ENV",
"moduleName": "@env",
"path": ".env",
"blocklist": null,
"allowlist": null,
"safe": false,
"allowUndefined": true,
"verbose": false
}]
plugins: [
'expo-router/babel',
[
'module:react-native-dotenv',
{
envName: 'APP_ENV',
moduleName: '@env',
path: '.env',
blocklist: null,
allowlist: null,
safe: false,
allowUndefined: true,
verbose: false,
},
],
],
};
};
9 changes: 5 additions & 4 deletions lib/DummyQueries.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { View } from 'react-native';
import { Button, Text } from 'react-native-elements';
import supabase from './supabase';

Expand Down Expand Up @@ -41,12 +42,12 @@ export default function DummyQueries() {
}

return (
<div>
<View>
<Button title="Get Case Data" onPress={() => allCases()} />
<Button title="Get Case Data" onPress={() => approvedCases()} />
<Button title="Get Case Data" onPress={() => unapprovedCases()} />
<Button title="Get Case Data" onPress={() => addCase()} />
<Text>{queryHolder ? "": queryHolder}</Text>
</div>
)
<Text>{queryHolder ? '' : queryHolder}</Text>
</View>
);
}
8 changes: 5 additions & 3 deletions lib/supabase.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { SUPABASE_ANON_KEY, SUPABASE_URL } from "@env";
import { createClient } from '@supabase/supabase-js';
import 'react-native-url-polyfill/auto';

if (!SUPABASE_URL || !SUPABASE_ANON_KEY) {
if (!process.env.SUPABASE_URL || !process.env.SUPABASE_ANON_KEY) {
throw new Error('Supabase environment variables are not defined.');
}
const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
const supabase = createClient(
process.env.SUPABASE_URL,
process.env.SUPABASE_ANON_KEY,
);

export default supabase;

0 comments on commit 8385da3

Please sign in to comment.