a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

redirect / => home if auth'd and add /new

+14 -1
+9
app/new/route.ts
··· 1 + import { createNewLeaflet } from "actions/createNewLeaflet"; 2 + 3 + export const preferredRegion = ["sfo1"]; 4 + export const dynamic = "force-dynamic"; 5 + export const fetchCache = "force-no-store"; 6 + 7 + export async function GET() { 8 + await createNewLeaflet("doc", true); 9 + }
+5 -1
app/route.ts
··· 1 1 import { createNewLeaflet } from "actions/createNewLeaflet"; 2 + import { cookies } from "next/headers"; 3 + import { redirect } from "next/navigation"; 2 4 3 5 export const preferredRegion = ["sfo1"]; 4 6 export const dynamic = "force-dynamic"; 5 7 export const fetchCache = "force-no-store"; 6 8 7 9 export async function GET() { 8 - await createNewLeaflet("doc", true); 10 + let auth_token = cookies().get("auth_token")?.value; 11 + if (auth_token) redirect("/home"); 12 + else await createNewLeaflet("doc", true); 9 13 }