feat: initial persistence (#3)
This commit is contained in:
@@ -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() {
|
||||
|
||||
9
packages/bolt/app/routes/chat.$id.tsx
Normal file
9
packages/bolt/app/routes/chat.$id.tsx
Normal 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;
|
||||
Reference in New Issue
Block a user