add notification
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import type { Route } from './+types'
|
||||
import type { Route } from './+types/layout'
|
||||
|
||||
import { useToggle } from 'ahooks'
|
||||
import { MenuIcon } from 'lucide-react'
|
||||
import { Link, NavLink, Outlet } from 'react-router'
|
||||
import { Toaster } from '@repo/ui/components/ui/sonner'
|
||||
|
||||
import { userContext } from '@repo/auth/context'
|
||||
import { authMiddleware } from '@repo/auth/middleware/auth'
|
||||
|
||||
import { ModeToggle, ThemedImage } from '@repo/ui/components/dark-mode'
|
||||
import { NavUser } from '@repo/ui/components/nav-user'
|
||||
import { Button } from '@repo/ui/components/ui/button'
|
||||
@@ -22,11 +22,12 @@ import {
|
||||
SheetTitle,
|
||||
SheetTrigger
|
||||
} from '@repo/ui/components/ui/sheet'
|
||||
import type { User } from '@repo/auth/auth'
|
||||
|
||||
export const middleware: Route.MiddlewareFunction[] = [authMiddleware]
|
||||
|
||||
export async function loader({ context }: Route.ActionArgs) {
|
||||
const user = context.get(userContext)
|
||||
const user = context.get(userContext) as User
|
||||
return Response.json({ user })
|
||||
}
|
||||
|
||||
@@ -45,8 +46,9 @@ const navMain = [
|
||||
}
|
||||
]
|
||||
|
||||
export default function Component({ loaderData }: Route.ComponentProps) {
|
||||
const { user } = loaderData
|
||||
export default function Component({
|
||||
loaderData: { user }
|
||||
}: Route.ComponentProps) {
|
||||
const [isOpen, { toggle }] = useToggle()
|
||||
|
||||
return (
|
||||
@@ -119,6 +121,12 @@ export default function Component({ loaderData }: Route.ComponentProps) {
|
||||
</header>
|
||||
|
||||
<Outlet />
|
||||
<Toaster
|
||||
position="top-center"
|
||||
richColors={true}
|
||||
duration={Infinity}
|
||||
closeButton={true}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user