aboutsummaryrefslogtreecommitdiff
path: root/apps/web/src/app
diff options
context:
space:
mode:
authorDhravya <[email protected]>2024-02-23 16:04:49 -0700
committerDhravya <[email protected]>2024-02-23 16:04:49 -0700
commitaa1b57bbcd99da4c6d68c145f7c07ea7bd35c8dc (patch)
treef5ab247b154a21bbebbe56cca0d7f3397219b7c3 /apps/web/src/app
parenthide bun lockfile (diff)
downloadsupermemory-aa1b57bbcd99da4c6d68c145f7c07ea7bd35c8dc.tar.xz
supermemory-aa1b57bbcd99da4c6d68c145f7c07ea7bd35c8dc.zip
chaos
Diffstat (limited to 'apps/web/src/app')
-rw-r--r--apps/web/src/app/account/client.tsx20
-rw-r--r--apps/web/src/app/account/page.tsx10
-rw-r--r--apps/web/src/app/api/auth/[...nextauth]/route.ts9
-rw-r--r--apps/web/src/app/api/store/route.ts3
-rw-r--r--apps/web/src/app/layout.tsx16
-rw-r--r--apps/web/src/app/page.tsx9
6 files changed, 20 insertions, 47 deletions
diff --git a/apps/web/src/app/account/client.tsx b/apps/web/src/app/account/client.tsx
deleted file mode 100644
index f05d0a3c..00000000
--- a/apps/web/src/app/account/client.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-'use client'
-
-import { useEffect } from "react"
-
-function MessagePoster({ jwt }: { jwt: string }) {
-
- useEffect(() => {
- if (typeof window === 'undefined') return
-
- // post every 1000ms
- setInterval(() => {
- window.postMessage({ jwt }, '*')
- }, 1000)
- }
- , [jwt])
-
- return null
-}
-
-export default MessagePoster \ No newline at end of file
diff --git a/apps/web/src/app/account/page.tsx b/apps/web/src/app/account/page.tsx
deleted file mode 100644
index 4503f416..00000000
--- a/apps/web/src/app/account/page.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import { cookies } from 'next/headers';
-import MessagePoster from './client';
-
-async function Page() {
- const token = cookies().get('next-auth.session-token')?.value
-
- return <MessagePoster jwt={token!} />
-}
-
-export default Page \ No newline at end of file
diff --git a/apps/web/src/app/api/auth/[...nextauth]/route.ts b/apps/web/src/app/api/auth/[...nextauth]/route.ts
index 1570f886..db7d1fb8 100644
--- a/apps/web/src/app/api/auth/[...nextauth]/route.ts
+++ b/apps/web/src/app/api/auth/[...nextauth]/route.ts
@@ -1,7 +1,2 @@
-import NextAuth from "next-auth";
-
-import { authOptions } from "@/server/auth";
-
-// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
-const handler = NextAuth(authOptions);
-export { handler as GET, handler as POST };
+export { GET, POST } from "@/server/auth";
+export const runtime = "edge";
diff --git a/apps/web/src/app/api/store/route.ts b/apps/web/src/app/api/store/route.ts
index 5c7e76d5..0d1c38ff 100644
--- a/apps/web/src/app/api/store/route.ts
+++ b/apps/web/src/app/api/store/route.ts
@@ -3,6 +3,8 @@ import { eq } from "drizzle-orm";
import { sessions, users } from "@/server/db/schema";
import { type NextRequest, NextResponse } from "next/server";
+export const runtime = "edge";
+
export async function GET(req: NextRequest) {
try {
const token = req.cookies.get("next-auth.session-token")?.value ?? req.headers.get("Authorization")?.replace("Bearer ", "");
@@ -13,7 +15,6 @@ export async function GET(req: NextRequest) {
if (!session || session.length === 0) {
return NextResponse.json({ message: "Invalid Key, session not found." }, { status: 404 });
}
-
return NextResponse.json({ message: "OK", data: session[0] }, { status: 200 });
} catch (error) {
return NextResponse.json({ message: "Error", error }, { status: 500 });
diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx
index 70f9df5d..9d62d395 100644
--- a/apps/web/src/app/layout.tsx
+++ b/apps/web/src/app/layout.tsx
@@ -1,18 +1,20 @@
-import "@/styles/globals.css";
+import '@/styles/globals.css';
-import { Inter } from "next/font/google";
+import { Inter } from 'next/font/google';
const inter = Inter({
- subsets: ["latin"],
- variable: "--font-sans",
+ subsets: ['latin'],
+ variable: '--font-sans',
});
export const metadata = {
- title: "Create T3 App",
- description: "Generated by create-t3-app",
- icons: [{ rel: "icon", url: "/favicon.ico" }],
+ title: 'Create T3 App',
+ description: 'Generated by create-t3-app',
+ icons: [{ rel: 'icon', url: '/favicon.ico' }],
};
+export const runtime = 'edge';
+
export default function RootLayout({
children,
}: {
diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx
index ba5030c7..3b9e44c4 100644
--- a/apps/web/src/app/page.tsx
+++ b/apps/web/src/app/page.tsx
@@ -1,7 +1,12 @@
-import Link from "next/link";
+import { cookies } from 'next/headers';
+import MessagePoster from '../../../anycontext-front/src/app/MessagePoster';
+
+export const runtime = 'edge';
export default function HomePage() {
return (
- <main>hi</main>
+ <main>
+ <MessagePoster jwt={cookies().get('next-auth.session-token')?.value!} />
+ </main>
);
}