Skip to content

Commit

Permalink
fix(platform): Type error in navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdip-b committed Dec 8, 2024
1 parent cb6bbcb commit 8199de8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions apps/platform/src/components/shared/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useEffect, useState } from 'react'
import { usePathname } from 'next/navigation'
import Link from 'next/link'
import { DropdownSVG } from '@public/svg/shared'
import type { User } from '@keyshade/schema'
import SearchModel from './searchModel'
import {
DropdownMenu,
Expand All @@ -16,7 +17,6 @@ import {
} from '@/components/ui/dropdown-menu'
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
import LineTab from '@/components/ui/line-tab'
import { zUser, type User } from '@/types'

interface UserNameImage {
name: string | null
Expand All @@ -32,11 +32,7 @@ async function fetchNameImage(): Promise<UserNameImage | undefined> {
credentials: 'include'
}
)
const userData: User = (await response.json()) as User
const { success, data } = zUser.safeParse(userData)
if (!success) {
throw new Error('Invalid data')
}
const data: User = (await response.json()) as User
return {
name: data.name?.split(' ')[0] ?? data.email.split('@')[0],
image: data.profilePictureUrl
Expand Down

0 comments on commit 8199de8

Please sign in to comment.