mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-25 20:32:11 +03:00
bd0aa01ba1
* feat: add redirectToLogin helper * feat: use redirectToLogin instead of redirect('login') * feat: redirect to initial targeted page after login
31 lines
729 B
TypeScript
31 lines
729 B
TypeScript
"use client";
|
|
import { ReactNode } from "react";
|
|
|
|
import { ChatsProvider } from "@/lib/context/ChatsProvider/chats-provider";
|
|
import { useSupabase } from "@/lib/context/SupabaseProvider";
|
|
import { redirectToLogin } from "@/lib/router/redirectToLogin";
|
|
|
|
import { ChatsList } from "./components/ChatsList";
|
|
|
|
interface LayoutProps {
|
|
children?: ReactNode;
|
|
}
|
|
|
|
const Layout = ({ children }: LayoutProps): JSX.Element => {
|
|
const { session } = useSupabase();
|
|
if (session === null) {
|
|
redirectToLogin();
|
|
}
|
|
|
|
return (
|
|
<ChatsProvider>
|
|
<div className="relative h-full w-full flex justify-stretch items-stretch">
|
|
<ChatsList />
|
|
{children}
|
|
</div>
|
|
</ChatsProvider>
|
|
);
|
|
};
|
|
|
|
export default Layout;
|