Skip to content

Commit 681bed7

Browse files
authored
Merge pull request #123 from ToyVallet/feat(host-admin)-368-dev
[TASK-368] host admin search 기능
2 parents be005f9 + b7907e8 commit 681bed7

File tree

25 files changed

+490
-175
lines changed

25 files changed

+490
-175
lines changed

apps/host-admin/.eslintrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
root: true,
3+
extends: [
4+
'@swifty/eslint-config/next.js',
5+
'plugin:@tanstack/eslint-plugin-query/recommended',
6+
],
7+
};

apps/host-admin/.eslintrc.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

apps/host-admin/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
"@swifty/tailwind-config": "*",
2020
"@swifty/typescript-config": "*",
2121
"@swifty/ui": "*",
22+
"@tanstack/react-query": "^5.52.2",
23+
"@tanstack/react-query-devtools": "^5.52.2",
2224
"@tanstack/react-table": "^8.20.1",
2325
"class-variance-authority": "^0.7.0",
2426
"clsx": "^2.1.1",
@@ -38,6 +40,7 @@
3840
"devDependencies": {
3941
"@playwright/test": "^1.42.1",
4042
"@svgr/webpack": "^8.1.0",
43+
"@tanstack/eslint-plugin-query": "^5.52.0",
4144
"@testing-library/jest-dom": "^6.4.2",
4245
"@testing-library/react": "^14.2.1",
4346
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11
import { Modal } from '@components';
22
import { type Params, http } from '@swifty/shared-lib';
3+
import {
4+
HydrationBoundary,
5+
QueryClient,
6+
dehydrate,
7+
} from '@tanstack/react-query';
38
import type { UserDetailApi } from '@type';
49

510
export default async function DetailPage({
611
params: { id },
712
}: Params<{ id: string }>) {
8-
const data = await http.get<UserDetailApi>(
9-
'/host/admin/certification/answer/{id}',
10-
{
11-
params: { id },
12-
credentials: 'include',
13-
},
14-
);
13+
const queryClient = new QueryClient();
14+
await queryClient.prefetchQuery({
15+
queryKey: [id],
16+
queryFn: async () =>
17+
await http.get<UserDetailApi>('/host/admin/certification/answer/{id}', {
18+
params: { id },
19+
credentials: 'include',
20+
}),
21+
});
22+
const dehydratedState = dehydrate(queryClient);
1523

16-
return <Modal {...data} />;
24+
return (
25+
<HydrationBoundary state={dehydratedState}>
26+
<Modal id={id} />
27+
</HydrationBoundary>
28+
);
1729
}

apps/host-admin/src/app/(main)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default async function MainLayout({
2121
<div className="w-full h-full">
2222
<header className="h-[100px] flex items-center justify-between bg-white px-10">
2323
<h1 className="text-32 font-bold">인증 관리</h1>
24-
<h6 className="text-20 font-semibold text-swifty-color-900 dark:text-swifty-color-50">
24+
<h6 className="text-20 font-semibold text-swifty-color-900">
2525
{universityName || ''}
2626
</h6>
2727
</header>

apps/host-admin/src/app/(main)/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { Home } from '@components';
22
import { Suspense } from 'react';
33
import PulseLoader from 'react-spinners/PulseLoader';
44

5+
export const dynamic = 'force-dynamic';
6+
57
export default async function HomePage() {
68
return (
79
<Suspense

apps/host-admin/src/app/layout.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ReactQueryProvider } from '@components';
12
import { Provider } from '@swifty/ui';
23
import '@swifty/ui/styles.css';
34
import type { Viewport } from 'next';
@@ -16,8 +17,10 @@ export const viewport: Viewport = {
1617
export default function RootLayout({ children }: PropsWithChildren) {
1718
return (
1819
<html lang="ko">
19-
<body className="font-Pretendard w-dvw h-dvh overflow-hidden scrollbar-hide bg-swifty-color-100 dark:bg-swifty-color-dark-bg">
20-
<Provider>{children}</Provider>
20+
<body className="font-Pretendard w-dvw h-dvh overflow-hidden scrollbar-hide bg-swifty-color-100 text-black">
21+
<Provider>
22+
<ReactQueryProvider>{children}</ReactQueryProvider>
23+
</Provider>
2124
</body>
2225
</html>
2326
);

apps/host-admin/src/components/common/template/sidebar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ function NavItem({ title, icon, href }: NavMenu) {
4949
const onClick = async () => {
5050
if (href) router.push(href);
5151
else {
52-
console.log('logout');
5352
await removeAllCookies();
5453
}
5554
};

0 commit comments

Comments
 (0)