-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
968 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_cHJvbXB0LW1hZ2dvdC02MC5jbGVyay5hY2NvdW50cy5kZXYk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
import { View, Text } from "react-native" | ||
import { SafeAreaView } from "react-native-safe-area-context" | ||
import { SignedIn, SignedOut, useUser } from '@clerk/clerk-expo' | ||
import { Link } from 'expo-router' | ||
import { Text, View } from 'react-native' | ||
|
||
const Home = () => { | ||
return( | ||
<SafeAreaView> | ||
<Text> | ||
Home | ||
</Text> | ||
</SafeAreaView> | ||
) | ||
} | ||
export default function Page() { | ||
const { user } = useUser() | ||
|
||
export default Home; | ||
return ( | ||
<View> | ||
<SignedIn> | ||
<Text>Hello {user?.emailAddresses[0].emailAddress}</Text> | ||
</SignedIn> | ||
<SignedOut> | ||
<Link href="/sign-in"> | ||
<Text>Sign In</Text> | ||
</Link> | ||
<Link href="/sign-up"> | ||
<Text>Sign Up</Text> | ||
</Link> | ||
</SignedOut> | ||
</View> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
import { useAuth } from "@clerk/clerk-expo" | ||
import { Redirect } from "expo-router" | ||
|
||
|
||
const Home = () => { | ||
const { isSignedIn } = useAuth() | ||
|
||
if (isSignedIn) { | ||
return <Redirect href={'/(root)/(tabs)/home'} /> | ||
} | ||
return <Redirect href="/(auth)/welcome/"></Redirect> | ||
|
||
|
||
} | ||
|
||
export default Home; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
import * as SecureStore from 'expo-secure-store' | ||
|
||
export interface TokenCache { | ||
getToken: (key: string) => Promise<string | undefined | null> | ||
saveToken: (key: string, token: string) => Promise<void> | ||
clearToken?: (key: string) => void | ||
} | ||
|
||
export const tokenCache = { | ||
async getToken(key: string) { | ||
try { | ||
const item = await SecureStore.getItemAsync(key) | ||
if (item) { | ||
console.log(`${key} was used 🔐 \n`) | ||
} else { | ||
console.log('No values stored under key: ' + key) | ||
} | ||
return item | ||
} catch (error) { | ||
console.error('SecureStore get item error: ', error) | ||
await SecureStore.deleteItemAsync(key) | ||
return null | ||
} | ||
}, | ||
async saveToken(key: string, value: string) { | ||
try { | ||
return SecureStore.setItemAsync(key, value) | ||
} catch (err) { | ||
return | ||
} | ||
}, | ||
} |
Oops, something went wrong.