From eac2367a1c813a465ea50869ee3aaee0b412c567 Mon Sep 17 00:00:00 2001 From: Bagasbanuna02 Date: Fri, 7 Feb 2025 11:11:29 +0800 Subject: [PATCH] fix use serach --- src/app/api/user/route.ts | 2 +- src/app_modules/home/view_home_new.tsx | 4 +- .../user_search/component/skeleton_view.tsx | 27 +++++++++ .../user_search/component/ui_user_search.tsx | 58 ++----------------- 4 files changed, 35 insertions(+), 56 deletions(-) create mode 100644 src/app_modules/user_search/component/skeleton_view.tsx diff --git a/src/app/api/user/route.ts b/src/app/api/user/route.ts index 8946e7f8..04860474 100644 --- a/src/app/api/user/route.ts +++ b/src/app/api/user/route.ts @@ -30,7 +30,7 @@ export async function GET(request: Request) { const { searchParams } = new URL(request.url); const search = searchParams.get("search"); const page = searchParams.get("page"); - const takeData = 1; + const takeData = 15; const skipData = Number(page) * takeData - takeData; if (!page) { diff --git a/src/app_modules/home/view_home_new.tsx b/src/app_modules/home/view_home_new.tsx index 71e41380..9397b7e9 100644 --- a/src/app_modules/home/view_home_new.tsx +++ b/src/app_modules/home/view_home_new.tsx @@ -85,7 +85,7 @@ export default function HomeViewNew() { - ) : dataUser && dataUser?.profile === undefined ? ( + ) : dataUser?.profile === undefined ? ( - ) : dataUser && dataUser?.profile === undefined ? ( + ) : dataUser?.profile === undefined ? ( + + {Array.from({ length: 2 }).map((e, i) => ( + + + + + + + + + + + + + + + ))} + + + ); +} diff --git a/src/app_modules/user_search/component/ui_user_search.tsx b/src/app_modules/user_search/component/ui_user_search.tsx index ad879d56..23e83cb4 100644 --- a/src/app_modules/user_search/component/ui_user_search.tsx +++ b/src/app_modules/user_search/component/ui_user_search.tsx @@ -25,6 +25,7 @@ import { useRouter } from "next/navigation"; import { useState } from "react"; import { userSearch_getAllUser } from "../fun/get/get_all_user"; import { apiGetUserSearch } from "./api_fetch_user_search"; +import { UserSearch_SkeletonView } from "./skeleton_view"; export function UserSearch_UiView() { const [data, setData] = useState([]); @@ -107,15 +108,15 @@ export function UserSearch_UiView() { onChange={(val) => handleSearch(val.target.value)} // disabled={isLoading} /> - {!data && isLoading ? ( - + {!data.length && isLoading ? ( + ) : ( - + {_.isEmpty(data) ? ( ) : ( (
@@ -170,61 +171,12 @@ function CardView({ data }: { data: MODEL_USER }) {
- {/* PAKE LOADING */} - {/* {loading ? ( - - ) : ( - - )} */} - - {/* GA PAKE LOADING */}
- - {/* { - setLoading(true); - router.push(RouterProfile.katalogOLD + `${data?.Profile?.id}`); - }} - > - - - - - - - - {data?.Profile.name}d sdasd sdas - - - +{data?.nomor} - - - - - -
- - {loading ? ( - - ) : ( - - )} - -
-
-
-
*/} ); }