mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
feat: add clerk auth support with convex (#548)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { useClerk } from "@clerk/clerk-expo";
|
||||
import { useRouter } from "expo-router";
|
||||
import { Text, TouchableOpacity } from "react-native";
|
||||
|
||||
export const SignOutButton = () => {
|
||||
// Use `useClerk()` to access the `signOut()` function
|
||||
const { signOut } = useClerk();
|
||||
const router = useRouter();
|
||||
|
||||
const handleSignOut = async () => {
|
||||
try {
|
||||
await signOut();
|
||||
// Redirect to your desired page
|
||||
router.replace("/");
|
||||
} catch (err) {
|
||||
// See https://clerk.com/docs/custom-flows/error-handling
|
||||
// for more info on error handling
|
||||
console.error(JSON.stringify(err, null, 2));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<TouchableOpacity onPress={handleSignOut}>
|
||||
<Text>Sign out</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user