mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
fix: internal server error when unauthenticated user goes to legal pages
This commit is contained in:
@@ -78,6 +78,7 @@ export default function LinkItem({
|
||||
href={url}
|
||||
target={'_blank'}
|
||||
rel='noreferrer'
|
||||
className='reset'
|
||||
>
|
||||
<span className={styles['link-name']}>
|
||||
{name} {favorite && <AiFillStar color='#ffc107' />}
|
||||
|
||||
@@ -8,11 +8,11 @@ import styles from './navbar.module.scss';
|
||||
|
||||
export default function Navbar() {
|
||||
const { status } = useSession();
|
||||
const { user } = useUser();
|
||||
const data = useUser();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const avatarLabel = t('common:avatar', {
|
||||
name: user?.name,
|
||||
name: data?.user?.name,
|
||||
});
|
||||
|
||||
return (
|
||||
@@ -29,17 +29,17 @@ export default function Navbar() {
|
||||
</li>
|
||||
{status === 'authenticated' ? (
|
||||
<>
|
||||
{user?.is_admin && (
|
||||
{data?.user?.is_admin && (
|
||||
<li>
|
||||
<LinkTag href={PATHS.ADMIN}>Admin</LinkTag>
|
||||
</li>
|
||||
)}
|
||||
<li className={styles['user']}>
|
||||
<RoundedImage
|
||||
src={user?.image}
|
||||
src={data?.user?.image}
|
||||
alt={avatarLabel}
|
||||
/>
|
||||
{user?.name}
|
||||
{data?.user?.name}
|
||||
</li>
|
||||
<li>
|
||||
<LinkTag href={PATHS.LOGOUT}>{t('common:logout')}</LinkTag>
|
||||
|
||||
Reference in New Issue
Block a user