feat : update
This commit is contained in:
@@ -31,7 +31,7 @@ export default async function StructuredEditorPage({
|
||||
params: Promise<{ character: string; page: string }>;
|
||||
}) {
|
||||
await connection();
|
||||
if (!(await getAdminSession())) redirect("/login?next=%2Fadmin");
|
||||
if (!(await getAdminSession())) redirect("/auth/login?next=%2Fadmin");
|
||||
const { character, page } = await params;
|
||||
const guide = await getGuideEditorHeader(character);
|
||||
if (!guide) notFound();
|
||||
|
||||
@@ -27,7 +27,7 @@ export const instant = false;
|
||||
|
||||
export default async function GuideOverviewPage({ params }: { params: Promise<{ character: string }> }) {
|
||||
await connection();
|
||||
if (!(await getAdminSession())) redirect("/login?next=%2Fadmin");
|
||||
if (!(await getAdminSession())) redirect("/auth/login?next=%2Fadmin");
|
||||
const { character } = await params;
|
||||
const guide = await getGuideByCharacterKey(character);
|
||||
if (!guide) notFound();
|
||||
|
||||
@@ -14,7 +14,7 @@ export default async function GuidePreviewPage({
|
||||
params: Promise<{ character: string; page?: string[] }>;
|
||||
}) {
|
||||
await connection();
|
||||
if (!(await getAdminSession())) redirect("/login?next=%2Fadmin");
|
||||
if (!(await getAdminSession())) redirect("/auth/login?next=%2Fadmin");
|
||||
const { character, page } = await params;
|
||||
if (page && page.length > 1) notFound();
|
||||
const header = await getGuideEditorHeader(character);
|
||||
|
||||
@@ -21,7 +21,7 @@ export default async function AuditLogPage({
|
||||
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
||||
}) {
|
||||
await connection();
|
||||
if (!(await getAdminSession())) redirect("/login?next=%2Fadmin");
|
||||
if (!(await getAdminSession())) redirect("/auth/login?next=%2Fadmin");
|
||||
|
||||
const query = await searchParams;
|
||||
const rawPage = Array.isArray(query.page) ? query.page[0] : query.page;
|
||||
|
||||
@@ -19,7 +19,7 @@ export const instant = false;
|
||||
export default async function AdminCommissionPage({ searchParams }: PageProps<"/admin/commission">) {
|
||||
await connection();
|
||||
const session = await getAdminSession();
|
||||
if (!session) redirect("/login?next=%2Fadmin");
|
||||
if (!session) redirect("/auth/login?next=%2Fadmin");
|
||||
const query = await searchParams;
|
||||
const rawPage = Number(query.page ?? 1);
|
||||
const page = Number.isInteger(rawPage) && rawPage > 0 ? Math.min(rawPage, 10000) : 1;
|
||||
|
||||
@@ -11,7 +11,7 @@ import { getActiveCatalog, listGuideCards } from "@/lib/guides/queries";
|
||||
|
||||
export default async function CreateGuidePage() {
|
||||
await connection();
|
||||
if (!(await getAdminSession())) redirect("/login?next=%2Fadmin");
|
||||
if (!(await getAdminSession())) redirect("/auth/login?next=%2Fadmin");
|
||||
const [catalog, guides] = await Promise.all([getActiveCatalog(), listGuideCards()]);
|
||||
if (!catalog) redirect("/admin?sync=required");
|
||||
return (
|
||||
|
||||
@@ -9,7 +9,7 @@ import { getCatalogOptions } from "@/lib/guides/queries";
|
||||
|
||||
export default async function GlossaryPage() {
|
||||
await connection();
|
||||
if (!(await getAdminSession())) redirect("/login?next=%2Fadmin");
|
||||
if (!(await getAdminSession())) redirect("/auth/login?next=%2Fadmin");
|
||||
const [catalog, aliases] = await Promise.all([
|
||||
getCatalogOptions(),
|
||||
listGlossaryAliases(),
|
||||
|
||||
@@ -9,7 +9,7 @@ export default async function ImageGeneratorLayout({
|
||||
children,
|
||||
}: LayoutProps<"/admin/image">) {
|
||||
await connection();
|
||||
if (!(await getAdminSession())) redirect("/login?next=%2Fadmin");
|
||||
if (!(await getAdminSession())) redirect("/auth/login?next=%2Fadmin");
|
||||
|
||||
return (
|
||||
<div className="min-h-svh">
|
||||
|
||||
@@ -5,7 +5,15 @@ import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
export default function AdminLayout({ children }: LayoutProps<"/admin">) {
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<Suspense fallback={null}>{children}</Suspense>
|
||||
<Suspense
|
||||
fallback={
|
||||
<main className="mx-auto flex min-h-svh w-full max-w-7xl items-start p-4 sm:p-6 lg:p-8">
|
||||
<p role="status" className="text-sm text-muted-foreground">กำลังโหลด…</p>
|
||||
</main>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</Suspense>
|
||||
</TooltipProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
export default function AdminLoading() {
|
||||
return (
|
||||
<main className="mx-auto flex min-h-svh w-full max-w-7xl items-start p-4 sm:p-6 lg:p-8">
|
||||
<p role="status" className="text-sm text-muted-foreground">กำลังโหลด…</p>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
+1
-1
@@ -12,7 +12,7 @@ export const instant = false;
|
||||
|
||||
export default async function AdminPage() {
|
||||
await connection();
|
||||
if (!(await getAdminSession())) redirect("/login?next=%2Fadmin");
|
||||
if (!(await getAdminSession())) redirect("/auth/login?next=%2Fadmin");
|
||||
const [guides, trash, catalogVersion] = await Promise.all([
|
||||
listGuideCards(),
|
||||
listGuideCards(true),
|
||||
|
||||
@@ -11,7 +11,7 @@ import { getStygianSchedule, listStygianSchedules } from "@/lib/stygian/reposito
|
||||
|
||||
export default async function AdminStygianPage({ searchParams }: { searchParams: Promise<Record<string, string | string[] | undefined>> }) {
|
||||
await connection();
|
||||
if (!(await getAdminSession())) redirect("/login?next=%2Fadmin");
|
||||
if (!(await getAdminSession())) redirect("/auth/login?next=%2Fadmin");
|
||||
const query = await searchParams;
|
||||
const schedules = await listStygianSchedules();
|
||||
const raw = Array.isArray(query.schedule) ? query.schedule[0] : query.schedule;
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function TemplatesPage() {
|
||||
redirect("/admin/create");
|
||||
}
|
||||
Reference in New Issue
Block a user