260703_01_FST: First Commit
This commit is contained in:
11
templates/base/src/app/(pages)/(main)/layout.tsx
Normal file
11
templates/base/src/app/(pages)/(main)/layout.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { cookies } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { AppMainLayout } from "@/components/app-shell/AppMainLayout";
|
||||
import { CookieKeys } from "@/store/cookie/cookie-keys";
|
||||
|
||||
export default async function MainLayout({ children }: Readonly<{ children: React.ReactNode }>) {
|
||||
const cookieStore = await cookies();
|
||||
const accessToken = cookieStore.get(CookieKeys.AuthToken)?.value;
|
||||
if (!accessToken) redirect("/logout");
|
||||
return <AppMainLayout>{children}</AppMainLayout>;
|
||||
}
|
||||
13
templates/base/src/app/(pages)/(main)/page.tsx
Normal file
13
templates/base/src/app/(pages)/(main)/page.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { AppPageTitle } from "@/components/app-shell/AppPageTitle";
|
||||
|
||||
export default function MainPage() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<AppPageTitle title="__DISPLAY_NAME__" description="프로젝트 기본 구성이 완료되었습니다." />
|
||||
<div className="rounded-lg border bg-card p-6 text-card-foreground shadow-sm">
|
||||
<p className="font-medium">다음 작업</p>
|
||||
<p className="mt-2 text-sm text-muted-foreground">메뉴와 API 경로를 프로젝트 업무에 맞게 확장하세요.</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
81
templates/base/src/app/(pages)/login/page.tsx
Normal file
81
templates/base/src/app/(pages)/login/page.tsx
Normal file
@@ -0,0 +1,81 @@
|
||||
"use client";
|
||||
|
||||
import Image from "next/image";
|
||||
import type React from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { apiError, NONE_HTTP_ERROR } from "@kri/common/http";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader } from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { useLoginMutation } from "@/query/auth";
|
||||
|
||||
export default function LoginPage() {
|
||||
const router = useRouter();
|
||||
const loginMutation = useLoginMutation();
|
||||
const passwordInputRef = useRef<HTMLInputElement | null>(null);
|
||||
const [userId, setUserId] = useState("");
|
||||
const [userPw, setUserPw] = useState("");
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const tryLogin = async () => {
|
||||
if (!userId.trim()) return window.alert("아이디를 입력해 주세요.");
|
||||
if (!userPw) return window.alert("비밀번호를 입력해 주세요.");
|
||||
|
||||
setError(null);
|
||||
try {
|
||||
await loginMutation.mutateAsync({ userId: userId.trim(), userPw });
|
||||
} catch (cause: unknown) {
|
||||
const errorInfo = apiError(cause, { fallbackMessage: "로그인에 실패했습니다." });
|
||||
if (errorInfo.status === 401 || errorInfo.status === 403) setError("아이디 또는 비밀번호를 다시 확인해 주세요.");
|
||||
else if (errorInfo.code === NONE_HTTP_ERROR) setError("알 수 없는 오류가 발생했습니다. 잠시 후 다시 시도해 주세요.");
|
||||
else setError(`로그인에 실패했습니다. (${errorInfo.message})`);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (loginMutation.isSuccess) router.replace("/");
|
||||
}, [loginMutation.isSuccess, router]);
|
||||
|
||||
const handleIdKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {
|
||||
if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
passwordInputRef.current?.focus();
|
||||
}
|
||||
};
|
||||
|
||||
const handlePasswordKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {
|
||||
if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
void tryLogin();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<main className="flex min-h-screen items-center justify-center bg-muted/40 p-4">
|
||||
<Card className="w-full max-w-md shadow-xl">
|
||||
<CardHeader className="pb-8">
|
||||
<div className="flex justify-center">
|
||||
<Image src="/logo.png" alt="로고" width={240} height={120} className="h-24 w-auto object-contain" priority />
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<label htmlFor="userId" className="text-sm font-medium">ID</label>
|
||||
<Input id="userId" autoComplete="username" placeholder="아이디를 입력하세요" value={userId} onChange={(event) => setUserId(event.currentTarget.value)} onKeyDown={handleIdKeyDown} />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label htmlFor="userPw" className="text-sm font-medium">Password</label>
|
||||
<Input ref={passwordInputRef} id="userPw" type="password" autoComplete="current-password" placeholder="비밀번호를 입력하세요" value={userPw} onChange={(event) => setUserPw(event.currentTarget.value)} onKeyDown={handlePasswordKeyDown} />
|
||||
</div>
|
||||
{error ? <p className="text-sm text-destructive">{error}</p> : null}
|
||||
<Button className="mt-6 h-11 w-full" disabled={loginMutation.isPending} onClick={() => void tryLogin()}>
|
||||
{loginMutation.isPending ? "로그인 중..." : "로그인"}
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
20
templates/base/src/app/(pages)/logout/page.tsx
Normal file
20
templates/base/src/app/(pages)/logout/page.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useLogoutMutation } from "@/query/auth";
|
||||
import { LoadingOverlayAdapter } from "@/components/app-shell/LoadingOverlayAdapter";
|
||||
|
||||
export default function LogoutPage() {
|
||||
const router = useRouter();
|
||||
const logoutMutation = useLogoutMutation();
|
||||
const started = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (started.current) return;
|
||||
started.current = true;
|
||||
void logoutMutation.mutateAsync().finally(() => router.replace("/login"));
|
||||
}, [logoutMutation, router]);
|
||||
|
||||
return <LoadingOverlayAdapter force label="로그아웃 중" />;
|
||||
}
|
||||
73
templates/base/src/app/api/example/[[...slug]]/route.ts
Normal file
73
templates/base/src/app/api/example/[[...slug]]/route.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { errorToResponse } from "@kri/common/http";
|
||||
import { createServerApi } from "@/lib/http-server";
|
||||
import type { RouteContext } from "@/types/common";
|
||||
|
||||
const apiPath = (slug: string[]) => `/example${slug.length ? `/${slug.map(encodeURIComponent).join("/")}` : ""}`;
|
||||
const toResponse = (result: unknown) => result === undefined ? new NextResponse(null, { status: 204 }) : NextResponse.json(result);
|
||||
|
||||
export async function GET(request: NextRequest, context: RouteContext) {
|
||||
try {
|
||||
const { slug = [] } = await context.params;
|
||||
const query = Object.fromEntries(request.nextUrl.searchParams.entries());
|
||||
const serverApi = await createServerApi();
|
||||
return toResponse(await serverApi.get<unknown>(apiPath(slug), { query }));
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest, context: RouteContext) {
|
||||
try {
|
||||
const { slug = [] } = await context.params;
|
||||
const serverApi = await createServerApi();
|
||||
const contentType = request.headers.get("content-type") ?? "";
|
||||
if (contentType.includes("multipart/form-data")) {
|
||||
return toResponse(await serverApi.postForm<unknown>(apiPath(slug), await request.formData()));
|
||||
}
|
||||
const body = await request.json().catch(() => undefined);
|
||||
return toResponse(await serverApi.post<unknown>(apiPath(slug), body));
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function PUT(request: NextRequest, context: RouteContext) {
|
||||
try {
|
||||
const { slug = [] } = await context.params;
|
||||
const serverApi = await createServerApi();
|
||||
const contentType = request.headers.get("content-type") ?? "";
|
||||
if (contentType.includes("multipart/form-data")) {
|
||||
return toResponse(await serverApi.putForm<unknown>(apiPath(slug), await request.formData()));
|
||||
}
|
||||
const body = await request.json().catch(() => undefined);
|
||||
return toResponse(await serverApi.put<unknown>(apiPath(slug), body));
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function PATCH(request: NextRequest, context: RouteContext) {
|
||||
try {
|
||||
const { slug = [] } = await context.params;
|
||||
const serverApi = await createServerApi();
|
||||
const body = await request.json().catch(() => undefined);
|
||||
return toResponse(await serverApi.patch<unknown>(apiPath(slug), body));
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function DELETE(request: NextRequest, context: RouteContext) {
|
||||
try {
|
||||
const { slug = [] } = await context.params;
|
||||
const serverApi = await createServerApi();
|
||||
const body = await request.json().catch(() => undefined);
|
||||
return toResponse(await serverApi.del<unknown>(apiPath(slug), body === undefined ? undefined : { json: body }));
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
}
|
||||
|
||||
// createHttpClient의 FormData 전용 메서드는 postForm과 putForm입니다.
|
||||
// PATCH/DELETE multipart가 필요하면 공용 HTTP Client 정책을 확인한 뒤 별도 구현하세요.
|
||||
32
templates/base/src/app/api/login/[[...slug]]/route.ts
Normal file
32
templates/base/src/app/api/login/[[...slug]]/route.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import type { LoginRequest, LoginUser } from "@kri/common";
|
||||
import { errorToResponse } from "@kri/common/http";
|
||||
import { AUTH_COOKIE_MAX_AGE } from "@/const/common.const";
|
||||
import { serverEnv } from "@/lib/env.server";
|
||||
import { createServerApi } from "@/lib/http-server";
|
||||
import { CookieKeys } from "@/store/cookie/cookie-keys";
|
||||
import type { RouteContext } from "@/types/common";
|
||||
|
||||
type LoginResponse = { accessToken: string; user: LoginUser };
|
||||
|
||||
export async function POST(request: NextRequest, context: RouteContext) {
|
||||
try {
|
||||
const { slug = [] } = await context.params;
|
||||
const serverApi = await createServerApi();
|
||||
const body = (await request.json()) as LoginRequest;
|
||||
const suffix = slug.length ? `/${slug.map(encodeURIComponent).join("/")}` : "";
|
||||
const result = await serverApi.post<LoginResponse>(`/auth/login${suffix}`, body);
|
||||
|
||||
const response = NextResponse.json(result.user, { status: 200 });
|
||||
response.cookies.set(CookieKeys.AuthToken, result.accessToken, {
|
||||
httpOnly: true,
|
||||
secure: serverEnv.ENV === "prod",
|
||||
sameSite: "lax",
|
||||
path: "/",
|
||||
maxAge: AUTH_COOKIE_MAX_AGE,
|
||||
});
|
||||
return response;
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
}
|
||||
27
templates/base/src/app/api/logout/[[...slug]]/route.ts
Normal file
27
templates/base/src/app/api/logout/[[...slug]]/route.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { errorToResponse } from "@kri/common/http";
|
||||
import { serverEnv } from "@/lib/env.server";
|
||||
import { createServerApi } from "@/lib/http-server";
|
||||
import { CookieKeys } from "@/store/cookie/cookie-keys";
|
||||
import type { RouteContext } from "@/types/common";
|
||||
|
||||
export async function POST(_request: NextRequest, context: RouteContext) {
|
||||
try {
|
||||
const { slug = [] } = await context.params;
|
||||
const serverApi = await createServerApi();
|
||||
const suffix = slug.length ? `/${slug.map(encodeURIComponent).join("/")}` : "";
|
||||
await serverApi.post<boolean>(`/auth/logout${suffix}`);
|
||||
|
||||
const response = NextResponse.json({ ok: true });
|
||||
response.cookies.set(CookieKeys.AuthToken, "", {
|
||||
httpOnly: true,
|
||||
secure: serverEnv.ENV === "prod",
|
||||
sameSite: "lax",
|
||||
path: "/",
|
||||
maxAge: 0,
|
||||
});
|
||||
return response;
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
}
|
||||
87
templates/base/src/app/globals.css
Normal file
87
templates/base/src/app/globals.css
Normal file
@@ -0,0 +1,87 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-card: var(--card);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-border: var(--border);
|
||||
--color-input: var(--input);
|
||||
--color-ring: var(--ring);
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
}
|
||||
|
||||
:root {
|
||||
--radius: 0.625rem;
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* { @apply border-border outline-ring/50; }
|
||||
body { @apply bg-background text-foreground; }
|
||||
}
|
||||
|
||||
.ProseMirror img { cursor: pointer; }
|
||||
.ProseMirror .ProseMirror-selectednode img { outline: 5px solid #0ea5e9; outline-offset: -5px; }
|
||||
.ProseMirror [data-resize-container] { position: relative; display: inline-block; }
|
||||
.ProseMirror [data-resize-handle] { position: absolute; width: 10px; height: 10px; box-sizing: border-box; background: #fff; border: 1px solid #0ea5e9; z-index: 10; opacity: 0; pointer-events: none; transition: opacity .12s ease-out; }
|
||||
.ProseMirror [data-resize-container]:hover [data-resize-handle] { opacity: 1; pointer-events: auto; }
|
||||
.ProseMirror [data-resize-handle="bottom-right"] { right: -5px; bottom: -5px; cursor: se-resize !important; }
|
||||
.ProseMirror [data-resize-handle="bottom-left"] { left: -5px; bottom: -5px; cursor: sw-resize !important; }
|
||||
.ProseMirror [data-resize-handle="top-right"] { right: -5px; top: -5px; cursor: ne-resize !important; }
|
||||
.ProseMirror [data-resize-handle="top-left"] { left: -5px; top: -5px; cursor: nw-resize !important; }
|
||||
21
templates/base/src/app/layout.tsx
Normal file
21
templates/base/src/app/layout.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Toaster } from "sonner";
|
||||
import { AppProvider } from "@/components/providers/AppProvider";
|
||||
import "./globals.css";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "__DISPLAY_NAME__",
|
||||
description: "__DESCRIPTION__",
|
||||
icons: { icon: "/favicon.ico" }
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
|
||||
return (
|
||||
<html lang="ko">
|
||||
<body className="min-h-screen antialiased">
|
||||
<AppProvider>{children}</AppProvider>
|
||||
<Toaster />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
11
templates/base/src/app/not-found.tsx
Normal file
11
templates/base/src/app/not-found.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import Link from "next/link";
|
||||
|
||||
export default function NotFound() {
|
||||
return (
|
||||
<main className="flex min-h-screen flex-col items-center justify-center gap-4 p-6 text-center">
|
||||
<p className="text-sm text-muted-foreground">404</p>
|
||||
<h1 className="text-2xl font-bold">페이지를 찾을 수 없습니다.</h1>
|
||||
<Link href="/" className="text-sm underline underline-offset-4">홈으로 이동</Link>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
40
templates/base/src/components/app-shell/AppHeader.tsx
Normal file
40
templates/base/src/components/app-shell/AppHeader.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
"use client";
|
||||
|
||||
import Image from "next/image";
|
||||
import { LogOut } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { KriHeader } from "@/components/layout/KriHeader";
|
||||
import { topMenus } from "@/config/menu.data";
|
||||
import type { LoginUser } from "@kri/common";
|
||||
|
||||
interface AppHeaderProps {
|
||||
menuOpen: boolean;
|
||||
showMenuButton: boolean;
|
||||
activeMenuId?: string;
|
||||
user?: LoginUser | null;
|
||||
onToggleMenu: () => void;
|
||||
onNavigate: (path: string) => void;
|
||||
}
|
||||
|
||||
export function AppHeader({ menuOpen, showMenuButton, activeMenuId, user, onToggleMenu, onNavigate }: AppHeaderProps) {
|
||||
return (
|
||||
<KriHeader
|
||||
logo={<Image src="/logo.png" alt="로고" width={120} height={40} className="h-10 w-auto object-contain" priority />}
|
||||
menus={topMenus}
|
||||
activeMenuId={activeMenuId}
|
||||
menuOpen={menuOpen}
|
||||
showMenuButton={showMenuButton}
|
||||
onToggleMenu={onToggleMenu}
|
||||
onNavigate={onNavigate}
|
||||
right={
|
||||
<>
|
||||
<span className="hidden text-sm text-muted-foreground sm:inline">{user?.userName ?? ""}</span>
|
||||
<Button variant="ghost" size="sm" className="gap-2" onClick={() => onNavigate("/logout")}>
|
||||
<LogOut className="size-4" />
|
||||
<span className="hidden sm:inline">로그아웃</span>
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
44
templates/base/src/components/app-shell/AppMainLayout.tsx
Normal file
44
templates/base/src/components/app-shell/AppMainLayout.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import { KriMainLayout } from "@/components/layout/KriMainLayout";
|
||||
import { AppHeader } from "./AppHeader";
|
||||
import { AppSidebar } from "./AppSidebar";
|
||||
import { sideMenus, topMenus } from "@/config/menu.data";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
|
||||
export function AppMainLayout({ children }: { children: React.ReactNode }) {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const { auth } = useAuth();
|
||||
const [menuOpen, setMenuOpen] = useState(true);
|
||||
|
||||
const activeMenuId = useMemo(
|
||||
() => topMenus.find((item) => item.path && (pathname === item.path || pathname.startsWith(`${item.path}/`)))?.id,
|
||||
[pathname],
|
||||
);
|
||||
|
||||
const navigate = (path: string) => router.push(path);
|
||||
const hasSidebar = sideMenus.length > 0;
|
||||
|
||||
return (
|
||||
<KriMainLayout
|
||||
sidebarOpen={hasSidebar && menuOpen}
|
||||
onSidebarOpenChange={setMenuOpen}
|
||||
header={
|
||||
<AppHeader
|
||||
menuOpen={menuOpen}
|
||||
showMenuButton={hasSidebar}
|
||||
activeMenuId={activeMenuId}
|
||||
user={auth.user}
|
||||
onToggleMenu={() => setMenuOpen((current) => !current)}
|
||||
onNavigate={navigate}
|
||||
/>
|
||||
}
|
||||
sidebar={hasSidebar ? <AppSidebar items={sideMenus} isOpen={menuOpen} pathname={pathname} onNavigate={navigate} /> : undefined}
|
||||
>
|
||||
{children}
|
||||
</KriMainLayout>
|
||||
);
|
||||
}
|
||||
10
templates/base/src/components/app-shell/AppPageTitle.tsx
Normal file
10
templates/base/src/components/app-shell/AppPageTitle.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { KriPageTitle } from "@/components/layout/KriPageTitle";
|
||||
|
||||
export interface AppPageTitleProps {
|
||||
title: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export function AppPageTitle({ title, description }: AppPageTitleProps) {
|
||||
return <KriPageTitle title={title} description={description} />;
|
||||
}
|
||||
15
templates/base/src/components/app-shell/AppSidebar.tsx
Normal file
15
templates/base/src/components/app-shell/AppSidebar.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import { KriSidebar } from "@/components/layout/KriSidebar";
|
||||
import type { SideMenuItem } from "@/config/menu.type";
|
||||
|
||||
interface AppSidebarProps {
|
||||
items: SideMenuItem[];
|
||||
isOpen: boolean;
|
||||
pathname: string;
|
||||
onNavigate: (path: string) => void;
|
||||
}
|
||||
|
||||
export function AppSidebar({ items, isOpen, pathname, onNavigate }: AppSidebarProps) {
|
||||
return <KriSidebar items={items} isOpen={isOpen} pathname={pathname} onNavigate={onNavigate} />;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { useAtomValue } from "jotai";
|
||||
import { KriLoadingOverlay, type KriLoadingOverlayProps } from "@/components/common/KriLoadingOverlay";
|
||||
import { loadingAtom } from "@/store/jotai/loading";
|
||||
|
||||
export type LoadingOverlayAdapterProps = Omit<KriLoadingOverlayProps, "open"> & { force?: boolean };
|
||||
|
||||
export function LoadingOverlayAdapter({ force = false, ...props }: LoadingOverlayAdapterProps) {
|
||||
const open = useAtomValue(loadingAtom);
|
||||
return <KriLoadingOverlay open={force || open} {...props} />;
|
||||
}
|
||||
5
templates/base/src/components/app-shell/index.ts
Normal file
5
templates/base/src/components/app-shell/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export { AppHeader } from "./AppHeader";
|
||||
export { AppMainLayout } from "./AppMainLayout";
|
||||
export { AppPageTitle } from "./AppPageTitle";
|
||||
export { AppSidebar } from "./AppSidebar";
|
||||
export { LoadingOverlayAdapter } from "./LoadingOverlayAdapter";
|
||||
18
templates/base/src/components/providers/AppProvider.tsx
Normal file
18
templates/base/src/components/providers/AppProvider.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
"use client";
|
||||
|
||||
import { Provider as JotaiProvider } from "jotai";
|
||||
import { QueryProvider } from "@kri/common/query";
|
||||
import { LoadingOverlayAdapter } from "@/components/app-shell/LoadingOverlayAdapter";
|
||||
import { QueryLoadingSync } from "./QueryLoadingSync";
|
||||
|
||||
export function AppProvider({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<JotaiProvider>
|
||||
<QueryProvider>
|
||||
<QueryLoadingSync />
|
||||
<LoadingOverlayAdapter />
|
||||
{children}
|
||||
</QueryProvider>
|
||||
</JotaiProvider>
|
||||
);
|
||||
}
|
||||
10
templates/base/src/components/providers/QueryLoadingSync.tsx
Normal file
10
templates/base/src/components/providers/QueryLoadingSync.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { QueryLoadingSync as CommonQueryLoadingSync } from "@kri/common/query";
|
||||
import { useSetAtom } from "jotai";
|
||||
import { queryLoadingAtom } from "@/store/jotai/loading";
|
||||
|
||||
export function QueryLoadingSync() {
|
||||
const setQueryLoading = useSetAtom(queryLoadingAtom);
|
||||
return <CommonQueryLoadingSync onLoadingChange={setQueryLoading} />;
|
||||
}
|
||||
7
templates/base/src/config/common.config.ts
Normal file
7
templates/base/src/config/common.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export const commonConfig = {
|
||||
appName: "__DISPLAY_NAME__",
|
||||
description: "__DESCRIPTION__",
|
||||
homePath: "/",
|
||||
loginPath: "/login",
|
||||
logoutPath: "/logout",
|
||||
} as const;
|
||||
7
templates/base/src/config/menu.data.ts
Normal file
7
templates/base/src/config/menu.data.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { SideMenuItem, TopMenuItem } from "./menu.type";
|
||||
|
||||
export const topMenus: TopMenuItem[] = [
|
||||
{ id: "home", label: "홈", path: "/" },
|
||||
];
|
||||
|
||||
export const sideMenus: SideMenuItem[] = [];
|
||||
4
templates/base/src/config/menu.type.ts
Normal file
4
templates/base/src/config/menu.type.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { KriNavigationItem } from "@/components/layout/types";
|
||||
|
||||
export type TopMenuItem = KriNavigationItem;
|
||||
export type SideMenuItem = KriNavigationItem;
|
||||
1
templates/base/src/const/common.const.ts
Normal file
1
templates/base/src/const/common.const.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const AUTH_COOKIE_MAX_AGE = 24 * 60 * 60;
|
||||
38
templates/base/src/hooks/useAuth.ts
Normal file
38
templates/base/src/hooks/useAuth.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback } from "react";
|
||||
import type { LoginUser } from "@kri/common";
|
||||
import { createAuthHook, type AuthState as CommonAuthState } from "@kri/common/hooks";
|
||||
import { getLocalStorage, removeLocalStorage, setLocalStorage } from "@/store/storage/secure-storage";
|
||||
import { StorageKeys } from "@/store/storage/storage-keys";
|
||||
|
||||
export type AuthState = CommonAuthState<LoginUser>;
|
||||
const initialAuthState: AuthState = { user: null };
|
||||
|
||||
const loadInitialAuthState = (): AuthState => {
|
||||
const stored = getLocalStorage(StorageKeys.AuthState);
|
||||
return stored && typeof stored === "object" && "user" in stored
|
||||
? { ...initialAuthState, ...(stored as Partial<AuthState>) }
|
||||
: initialAuthState;
|
||||
};
|
||||
|
||||
const { authAtom, useAuth: useCommonAuth } = createAuthHook<LoginUser>({ initialState: loadInitialAuthState() });
|
||||
export const authStateAtom = authAtom;
|
||||
|
||||
export function useAuth() {
|
||||
const { auth, setAuth: setCommonAuth } = useCommonAuth();
|
||||
|
||||
const setAuth = useCallback((next: AuthState | ((previous: AuthState) => AuthState)) => {
|
||||
setCommonAuth((previous) => {
|
||||
const resolved = typeof next === "function" ? next(previous) : next;
|
||||
if (resolved.user === null) removeLocalStorage(StorageKeys.AuthState);
|
||||
else setLocalStorage(StorageKeys.AuthState, resolved);
|
||||
return resolved;
|
||||
});
|
||||
}, [setCommonAuth]);
|
||||
|
||||
const setFromLoginResponse = useCallback((user: LoginUser) => setAuth({ user }), [setAuth]);
|
||||
const logout = useCallback(() => setAuth(initialAuthState), [setAuth]);
|
||||
|
||||
return { auth, setAuth, setFromLoginResponse, logout } as const;
|
||||
}
|
||||
23
templates/base/src/hooks/useDialog.ts
Normal file
23
templates/base/src/hooks/useDialog.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback } from "react";
|
||||
import { createDialogHook } from "@kri/common/hooks";
|
||||
import type { DialogId } from "@/store/jotai/dialog";
|
||||
|
||||
const { openDialogIdsAtom, useDialog: useCommonDialog } = createDialogHook<DialogId>();
|
||||
export { openDialogIdsAtom };
|
||||
|
||||
export function useDialog() {
|
||||
const { openDialogIds, isDialogOpen, openDialog, closeDialog, closeAllDialogs } = useCommonDialog();
|
||||
const showDialog = useCallback((id: DialogId, onlyThis = true) => {
|
||||
if (onlyThis) closeAllDialogs();
|
||||
openDialog(id);
|
||||
}, [closeAllDialogs, openDialog]);
|
||||
return {
|
||||
openDialogIds,
|
||||
isDialogOpen,
|
||||
showDialog,
|
||||
hideDialog: closeDialog,
|
||||
hideAll: closeAllDialogs,
|
||||
} as const;
|
||||
}
|
||||
7
templates/base/src/hooks/useLoading.ts
Normal file
7
templates/base/src/hooks/useLoading.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { createLoadingHook } from "@kri/common/hooks";
|
||||
|
||||
const { loadingCountAtom, isLoadingAtom, useLoading } = createLoadingHook();
|
||||
export { loadingCountAtom, isLoadingAtom, useLoading };
|
||||
export const manualLoadingAtom = isLoadingAtom;
|
||||
17
templates/base/src/hooks/useStorage.ts
Normal file
17
templates/base/src/hooks/useStorage.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import { createStorageHook } from "@kri/common/hooks";
|
||||
import type { AuthState } from "@/hooks/useAuth";
|
||||
import { getLocalStorage, getSessionStorage, removeLocalStorage, removeSessionStorage, setLocalStorage, setSessionStorage } from "@/store/storage/secure-storage";
|
||||
import { StorageKeys, StorageType } from "@/store/storage/storage-keys";
|
||||
|
||||
type AppStorageSchema = { [StorageKeys.AuthState]: AuthState };
|
||||
type AppStorageKey = Extract<keyof AppStorageSchema, string>;
|
||||
|
||||
const useCommonStorage = createStorageHook<AppStorageSchema>({
|
||||
resolveStorageScope: (key) => StorageType[key],
|
||||
localStorageAdapter: { get: getLocalStorage, set: setLocalStorage, remove: removeLocalStorage },
|
||||
sessionStorageAdapter: { get: getSessionStorage, set: setSessionStorage, remove: removeSessionStorage },
|
||||
});
|
||||
|
||||
export const useStorage = <TKey extends AppStorageKey>(key: TKey) => useCommonStorage(key);
|
||||
8
templates/base/src/lib/env.client.ts
Normal file
8
templates/base/src/lib/env.client.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { createEnv, env } from "@kri/common/config";
|
||||
|
||||
export const clientEnv = createEnv({
|
||||
ENV: env.required("NEXT_PUBLIC_ENV", process.env.NEXT_PUBLIC_ENV),
|
||||
API_BASE: env.required("NEXT_PUBLIC_API_BASE", process.env.NEXT_PUBLIC_API_BASE),
|
||||
STORE_KEY: env.required("NEXT_PUBLIC_STORE_KEY", process.env.NEXT_PUBLIC_STORE_KEY),
|
||||
STORE_IV: env.required("NEXT_PUBLIC_STORE_IV", process.env.NEXT_PUBLIC_STORE_IV),
|
||||
});
|
||||
7
templates/base/src/lib/env.server.ts
Normal file
7
templates/base/src/lib/env.server.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import "server-only";
|
||||
import { createEnv, env } from "@kri/common/config";
|
||||
|
||||
export const serverEnv = createEnv({
|
||||
ENV: env.required("ENV", process.env.ENV),
|
||||
API_SERVER: env.required("API_SERVER", process.env.API_SERVER),
|
||||
});
|
||||
4
templates/base/src/lib/http-client.ts
Normal file
4
templates/base/src/lib/http-client.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { createHttpClient } from "@kri/common/http";
|
||||
import { clientEnv } from "@/lib/env.client";
|
||||
|
||||
export const nextApi = createHttpClient(clientEnv.API_BASE);
|
||||
13
templates/base/src/lib/http-server.ts
Normal file
13
templates/base/src/lib/http-server.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { cookies } from "next/headers";
|
||||
import { createHttpClient } from "@kri/common/http";
|
||||
import { serverEnv } from "@/lib/env.server";
|
||||
import { CookieKeys } from "@/store/cookie/cookie-keys";
|
||||
|
||||
export async function createServerApi() {
|
||||
const cookieStore = await cookies();
|
||||
const accessToken = cookieStore.get(CookieKeys.AuthToken)?.value ?? null;
|
||||
return createHttpClient(serverEnv.API_SERVER, {
|
||||
getToken: () => accessToken,
|
||||
defaultHeaders: { "content-type": "application/json" },
|
||||
});
|
||||
}
|
||||
14
templates/base/src/lib/security.ts
Normal file
14
templates/base/src/lib/security.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { createSecurity } from "@kri/common/security";
|
||||
import { clientEnv } from "@/lib/env.client";
|
||||
|
||||
export const Security = createSecurity({
|
||||
key: clientEnv.STORE_KEY,
|
||||
iv: clientEnv.STORE_IV,
|
||||
onInvalidConfig: ({ message }) => {
|
||||
if (typeof window === "undefined" || clientEnv.ENV !== "local") return;
|
||||
const target = window as Window & { __kriCryptoConfigAlerted?: boolean };
|
||||
if (target.__kriCryptoConfigAlerted) return;
|
||||
target.__kriCryptoConfigAlerted = true;
|
||||
window.alert(message);
|
||||
},
|
||||
});
|
||||
1
templates/base/src/lib/utils.ts
Normal file
1
templates/base/src/lib/utils.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { cn } from "@kri/common/ui";
|
||||
10
templates/base/src/proxy.ts
Normal file
10
templates/base/src/proxy.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export const config = {
|
||||
matcher: ["/example/:path*"],
|
||||
};
|
||||
|
||||
export function proxy(_request: NextRequest) {
|
||||
// 인증, Header 추가, Redirect 같은 공통 처리를 구현할 수 있습니다.
|
||||
return NextResponse.next();
|
||||
}
|
||||
41
templates/base/src/query/auth.ts
Normal file
41
templates/base/src/query/auth.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
"use client";
|
||||
|
||||
import type { LoginRequest, LoginUser } from "@kri/common";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import { nextApi } from "@/lib/http-client";
|
||||
|
||||
export function useLoginMutation() {
|
||||
const { setFromLoginResponse } = useAuth();
|
||||
return useMutation({
|
||||
mutationFn: (request: LoginRequest) => nextApi.post<LoginUser>("/login", request, {
|
||||
skipUnauthorizedHandler: true,
|
||||
skipForbiddenHandler: true,
|
||||
skipResponseErrorHandler: true,
|
||||
}),
|
||||
onSuccess: setFromLoginResponse,
|
||||
});
|
||||
}
|
||||
|
||||
export function useLogoutMutation() {
|
||||
const queryClient = useQueryClient();
|
||||
const { auth, logout } = useAuth();
|
||||
return useMutation({
|
||||
mutationFn: async () => {
|
||||
const suffix = auth.user?.userId ? `/${encodeURIComponent(auth.user.userId)}` : "";
|
||||
try {
|
||||
await nextApi.post(`/logout${suffix}`, null, {
|
||||
skipUnauthorizedHandler: true,
|
||||
skipForbiddenHandler: true,
|
||||
skipResponseErrorHandler: true,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
onSettled: () => {
|
||||
logout();
|
||||
queryClient.clear();
|
||||
},
|
||||
});
|
||||
}
|
||||
56
templates/base/src/query/example.ts
Normal file
56
templates/base/src/query/example.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
"use client";
|
||||
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { nextApi } from "@/lib/http-client";
|
||||
import { queryKeys } from "@/query/key/keys";
|
||||
import type { ExampleItem, ExampleRequest } from "@/types/common";
|
||||
|
||||
export const useExampleQuery = (id: string) => useQuery({
|
||||
queryKey: queryKeys.example.detail(id),
|
||||
queryFn: () => nextApi.get<ExampleItem>(`/example/${id}`),
|
||||
enabled: Boolean(id),
|
||||
});
|
||||
|
||||
export function useCreateExampleMutation() {
|
||||
const client = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (body: ExampleRequest) => nextApi.post<ExampleItem>("/example", body),
|
||||
onSuccess: () => client.invalidateQueries({ queryKey: queryKeys.example.all }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useUpdateExampleMutation(id: string) {
|
||||
const client = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (body: ExampleRequest) => nextApi.put<ExampleItem>(`/example/${id}`, body),
|
||||
onSuccess: () => client.invalidateQueries({ queryKey: queryKeys.example.all }),
|
||||
});
|
||||
}
|
||||
|
||||
export function usePatchExampleMutation(id: string) {
|
||||
const client = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (body: Partial<ExampleRequest>) => nextApi.patch<ExampleItem>(`/example/${id}`, body),
|
||||
onSuccess: () => client.invalidateQueries({ queryKey: queryKeys.example.all }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDeleteExampleMutation() {
|
||||
const client = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => nextApi.del<void>(`/example/${id}`),
|
||||
onSuccess: () => client.invalidateQueries({ queryKey: queryKeys.example.all }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useUploadExampleMutation(id: string) {
|
||||
return useMutation({
|
||||
mutationFn: (formData: FormData) => nextApi.postForm<ExampleItem>(`/example/${id}`, formData),
|
||||
});
|
||||
}
|
||||
|
||||
export function useReplaceExampleFileMutation(id: string) {
|
||||
return useMutation({
|
||||
mutationFn: (formData: FormData) => nextApi.putForm<ExampleItem>(`/example/${id}`, formData),
|
||||
});
|
||||
}
|
||||
6
templates/base/src/query/key/keys.ts
Normal file
6
templates/base/src/query/key/keys.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export const queryKeys = {
|
||||
example: {
|
||||
all: ["example"] as const,
|
||||
detail: (id: string) => ["example", id] as const,
|
||||
},
|
||||
} as const;
|
||||
9
templates/base/src/store/cookie/client-cookie.ts
Normal file
9
templates/base/src/store/cookie/client-cookie.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { createCookieStore, type CookieSetOptions } from "@kri/common/browser";
|
||||
import type { CookieKey } from "./cookie-keys";
|
||||
|
||||
export type { CookieSetOptions };
|
||||
export const cookieStore = createCookieStore<CookieKey>({
|
||||
defaults: { days: 365, path: "/", secure: false, sameSite: "Lax" },
|
||||
});
|
||||
5
templates/base/src/store/cookie/cookie-keys.ts
Normal file
5
templates/base/src/store/cookie/cookie-keys.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export const CookieKeys = {
|
||||
AuthToken: "kri_authToken",
|
||||
} as const;
|
||||
|
||||
export type CookieKey = (typeof CookieKeys)[keyof typeof CookieKeys];
|
||||
2
templates/base/src/store/jotai/auth.ts
Normal file
2
templates/base/src/store/jotai/auth.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
"use client";
|
||||
export { authStateAtom, type AuthState } from "@/hooks/useAuth";
|
||||
1
templates/base/src/store/jotai/dialog.ts
Normal file
1
templates/base/src/store/jotai/dialog.ts
Normal file
@@ -0,0 +1 @@
|
||||
export type DialogId = "exampleDialog";
|
||||
8
templates/base/src/store/jotai/loading.ts
Normal file
8
templates/base/src/store/jotai/loading.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import { atom } from "jotai";
|
||||
import { isLoadingAtom } from "@/hooks/useLoading";
|
||||
|
||||
export const manualLoadingAtom = isLoadingAtom;
|
||||
export const queryLoadingAtom = atom(false);
|
||||
export const loadingAtom = atom((get) => get(isLoadingAtom) || get(queryLoadingAtom));
|
||||
27
templates/base/src/store/storage/secure-storage.ts
Normal file
27
templates/base/src/store/storage/secure-storage.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import { createJsonStorage, type JsonStorageTransform } from "@kri/common/browser";
|
||||
import { clientEnv } from "@/lib/env.client";
|
||||
import { Security } from "@/lib/security";
|
||||
|
||||
const securityTransform: JsonStorageTransform = {
|
||||
encode: (value) => Security.encryptBase64(value),
|
||||
decode: (value) => Security.decryptBase64(value),
|
||||
};
|
||||
|
||||
const options = (storage: "local" | "session") => ({
|
||||
storage,
|
||||
fallbackToPlainJson: true,
|
||||
...(clientEnv.ENV === "prod" ? { transform: securityTransform } : {}),
|
||||
} as const);
|
||||
|
||||
const local = createJsonStorage(options("local"));
|
||||
const session = createJsonStorage(options("session"));
|
||||
export const setLocalStorage = local.set;
|
||||
export const getLocalStorage = local.get;
|
||||
export const removeLocalStorage = local.remove;
|
||||
export const clearLocalStorage = local.clear;
|
||||
export const setSessionStorage = session.set;
|
||||
export const getSessionStorage = session.get;
|
||||
export const removeSessionStorage = session.remove;
|
||||
export const clearSessionStorage = session.clear;
|
||||
8
templates/base/src/store/storage/storage-keys.ts
Normal file
8
templates/base/src/store/storage/storage-keys.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export const StorageKeys = {
|
||||
AuthState: "kri:authState",
|
||||
} as const;
|
||||
|
||||
export type StorageKey = (typeof StorageKeys)[keyof typeof StorageKeys];
|
||||
export const StorageType: Record<StorageKey, "local" | "session"> = {
|
||||
[StorageKeys.AuthState]: "local",
|
||||
};
|
||||
12
templates/base/src/types/common.ts
Normal file
12
templates/base/src/types/common.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export type RouteContext = {
|
||||
params: Promise<{ slug?: string[] }>;
|
||||
};
|
||||
|
||||
export interface ExampleItem {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface ExampleRequest {
|
||||
name: string;
|
||||
}
|
||||
Reference in New Issue
Block a user