Skip to content

Commit

Permalink
chore: cleanup next.js dev app header (#10002)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed Feb 11, 2024
1 parent 4480bdf commit d5e7c7e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 25 deletions.
4 changes: 2 additions & 2 deletions apps/dev/nextjs/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ export async function AppHeader() {
session={session}
signIn={
<form
action={async (formData) => {
action={async () => {
"use server"
try {
await signIn("credentials", formData)
await signIn()
} catch (error) {
if (error instanceof AuthError) {
console.log(error)
Expand Down
37 changes: 14 additions & 23 deletions apps/dev/nextjs/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,14 @@ export function Header({
return (
<header className={styles.header}>
<div className={styles.signedInStatus}>
{!session?.user && (
<img
src={
session?.user?.image ?? "https://source.boringavatars.com/beam/120"
}
className={styles.avatar}
/>
{session?.user ? (
<>
<img
src={
session?.user?.image ??
"https://source.boringavatars.com/beam/120"
}
className={styles.avatar}
/>
<span className={styles.notSignedInText}>
You are not signed in
</span>
{signIn}
</>
)}
{session?.user && (
<>
<img
src={
session?.user?.image ??
"https://source.boringavatars.com/beam/120"
}
className={styles.avatar}
/>
<span className={styles.signedInText}>
<small>Signed in as</small>
<br />
Expand All @@ -46,6 +30,13 @@ export function Header({
</span>
{signOut}
</>
) : (
<>
<span className={styles.notSignedInText}>
You are not signed in
</span>
{signIn}
</>
)}
</div>
<nav>
Expand Down

0 comments on commit d5e7c7e

Please sign in to comment.