feat: initial persistence (#3)

This commit is contained in:
Kirjava
2024-07-25 14:03:38 +01:00
committed by GitHub
parent 2b1bf0fdaf
commit 5db834e2f7
9 changed files with 249 additions and 51 deletions

View File

@@ -1,22 +1,16 @@
import { json, redirect, type LoaderFunctionArgs, type MetaFunction } from '@remix-run/cloudflare';
import { type LoaderFunctionArgs, type MetaFunction } from '@remix-run/cloudflare';
import { ClientOnly } from 'remix-utils/client-only';
import { BaseChat } from '~/components/chat/BaseChat';
import { Chat } from '~/components/chat/Chat.client';
import { Header } from '~/components/Header';
import { isAuthenticated } from '~/lib/.server/sessions';
import { handleAuthRequest } from '~/lib/.server/login';
export const meta: MetaFunction = () => {
return [{ title: 'Bolt' }, { name: 'description', content: 'Talk with Bolt, an AI assistant from StackBlitz' }];
};
export async function loader({ request, context }: LoaderFunctionArgs) {
const authenticated = await isAuthenticated(request, context.cloudflare.env);
if (import.meta.env.DEV || authenticated) {
return json({});
}
return redirect('/login');
export async function loader(args: LoaderFunctionArgs) {
return handleAuthRequest(args);
}
export default function Index() {

View File

@@ -0,0 +1,9 @@
import type { LoaderFunctionArgs } from '@remix-run/cloudflare';
import { default as IndexRoute } from './_index';
import { handleAuthRequest } from '~/lib/.server/login';
export async function loader(args: LoaderFunctionArgs) {
return handleAuthRequest(args, { id: args.params.id });
}
export default IndexRoute;