diff --git a/app/(root)/profile/page.tsx b/app/(root)/profile/page.tsx index 6e1b1b7..6af6c4c 100644 --- a/app/(root)/profile/page.tsx +++ b/app/(root)/profile/page.tsx @@ -8,14 +8,13 @@ import PodcastCard from "@/components/PodcastCard"; import ProfileCard from "@/components/ProfileCard"; import { api } from "@/convex/_generated/api"; import { ProfilePodcastProps } from "@/types"; -import { useClerk } from "@clerk/nextjs"; const MyProfilePage = () => { - const { user } = useClerk(); + const user = useQuery(api.users.getUser); const podcastsData = useQuery(api.podcasts.getPodcastByAuthorId, { - authorId: user?.id!, + authorId: user?.clerkId!, }) as ProfilePodcastProps; if (!user || !podcastsData) return ; @@ -27,10 +26,10 @@ const MyProfilePage = () => {
diff --git a/components/RightSidebar.tsx b/components/RightSidebar.tsx index 83c767f..206c0e8 100644 --- a/components/RightSidebar.tsx +++ b/components/RightSidebar.tsx @@ -27,7 +27,11 @@ const RightSidebar = () => {
-

{user?.firstName} {user?.lastName}

+

+ { user?.firstName && user?.lastName ? + user?.firstName + " " + user?.lastName + : user?.emailAddresses[0].emailAddress.split("@")[0]} +

arrow { clerkId: event.data.id, email: event.data.email_addresses[0].email_address, imageUrl: event.data.image_url, - name: event.data.first_name!, + name: event.data.first_name + ? event.data.first_name + " " + (event.data.last_name ?? "") + : event.data.email_addresses[0].email_address.split("@")[0], }); break; case "user.updated":