mirror of
https://github.com/linsa-io/linsa.git
synced 2026-04-27 02:38:45 +02:00
.
This commit is contained in:
25
packages/web/src/routes/chat.tsx
Normal file
25
packages/web/src/routes/chat.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { createFileRoute, redirect } from "@tanstack/react-router"
|
||||
import { authClient } from "@/lib/auth-client"
|
||||
import {
|
||||
chatThreadsCollection,
|
||||
chatMessagesCollection,
|
||||
} from "@/lib/collections"
|
||||
import { ChatPage } from "@/components/chat/ChatPage"
|
||||
|
||||
export const Route = createFileRoute("/chat")({
|
||||
ssr: false,
|
||||
beforeLoad: async () => {
|
||||
const session = await authClient.getSession()
|
||||
if (!session.data?.session) {
|
||||
throw redirect({ to: "/login" })
|
||||
}
|
||||
},
|
||||
loader: async () => {
|
||||
await Promise.all([
|
||||
chatThreadsCollection.preload(),
|
||||
chatMessagesCollection.preload(),
|
||||
])
|
||||
return null
|
||||
},
|
||||
component: ChatPage,
|
||||
})
|
||||
Reference in New Issue
Block a user