|
@@ -2,7 +2,8 @@ import dynamicImport from "next/dynamic";
|
|
|
import Grid from "@/components/theme/ui/grid/Grid";
|
|
import Grid from "@/components/theme/ui/grid/Grid";
|
|
|
import NotFound from "@/components/theme/search/not-found";
|
|
import NotFound from "@/components/theme/search/not-found";
|
|
|
import { isArray } from "@/utils/type-guards";
|
|
import { isArray } from "@/utils/type-guards";
|
|
|
-import { GET_FILTER_PRODUCTS } from "@/graphql";
|
|
|
|
|
|
|
+import {serverGraphqlFetch} from "@utils/bagisto/index";
|
|
|
|
|
+import { GET_FILTER_PRODUCTS,SEARCH_PRODUCTS } from "@/graphql";
|
|
|
import { GET_PRODUCTS, GET_PRODUCTS_PAGINATION } from "@/graphql";
|
|
import { GET_PRODUCTS, GET_PRODUCTS_PAGINATION } from "@/graphql";
|
|
|
import {
|
|
import {
|
|
|
cachedGraphQLRequest,
|
|
cachedGraphQLRequest,
|
|
@@ -13,7 +14,7 @@ import SortOrder from "@/components/theme/filters/SortOrder";
|
|
|
import { SortByFields } from "@/utils/constants";
|
|
import { SortByFields } from "@/utils/constants";
|
|
|
import MobileFilter from "@/components/theme/filters/MobileFilter";
|
|
import MobileFilter from "@/components/theme/filters/MobileFilter";
|
|
|
import FilterList from "@/components/theme/filters/FilterList";
|
|
import FilterList from "@/components/theme/filters/FilterList";
|
|
|
-import { ProductsResponse } from "@/components/catalog/type";
|
|
|
|
|
|
|
+import { ProductsResponse,SearchProductsResponse, SearchProductsVariables } from "@/components/catalog/type";
|
|
|
import { MobileSearchBar } from "@components/layout/navbar/MobileSearch";
|
|
import { MobileSearchBar } from "@components/layout/navbar/MobileSearch";
|
|
|
import HotSearch from "./_components/HotSearch"
|
|
import HotSearch from "./_components/HotSearch"
|
|
|
const Pagination = dynamicImport(
|
|
const Pagination = dynamicImport(
|
|
@@ -110,7 +111,15 @@ export default async function SearchPage({
|
|
|
} = (params || {}) as {
|
|
} = (params || {}) as {
|
|
|
[key: string]: string;
|
|
[key: string]: string;
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
|
|
+const searchRes = await serverGraphqlFetch<SearchProductsResponse,SearchProductsVariables>({
|
|
|
|
|
+ query: SEARCH_PRODUCTS,
|
|
|
|
|
+ variables: {
|
|
|
|
|
+ "suggest": true,
|
|
|
|
|
+ "query": "reaady",
|
|
|
|
|
+ "first": 20
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log('ssssss ------ ', searchRes);
|
|
|
const itemsPerPage = 12;
|
|
const itemsPerPage = 12;
|
|
|
const currentPage = page ? parseInt(page) - 1 : 0;
|
|
const currentPage = page ? parseInt(page) - 1 : 0;
|
|
|
const sortValue = params?.sort || "name-asc";
|
|
const sortValue = params?.sort || "name-asc";
|