zgl преди 1 седмица
родител
ревизия
61873429c9
променени са 2 файла, в които са добавени 4 реда и са изтрити 4 реда
  1. 1 1
      src/app/(public)/product/[...urlProduct]/page.tsx
  2. 3 3
      src/utils/hooks/useCache.ts

+ 1 - 1
src/app/(public)/product/[...urlProduct]/page.tsx

@@ -35,7 +35,7 @@ async function getSingleProduct(urlKey: string) {
 
 
   try {
   try {
     const {data:dataById} = await cachedProductRequest<SingleProductResponse>(
     const {data:dataById} = await cachedProductRequest<SingleProductResponse>(
-      urlKey, // 产品名称
+      // urlKey, // 产品名称
       GET_PRODUCT_BY_URL_KEY, // gql查询语句
       GET_PRODUCT_BY_URL_KEY, // gql查询语句
       { urlKey: urlKey },
       { urlKey: urlKey },
     );
     );

+ 3 - 3
src/utils/hooks/useCache.ts

@@ -61,7 +61,7 @@ export function getPageCacheConfig(
 //     life: "hours",
 //     life: "hours",
 //   };
 //   };
 // }
 // }
-export function getProductCacheConfig(productId: string): {noCache: boolean} {
+export function getProductCacheConfig(): {noCache: boolean} {
   return {noCache: true};
   return {noCache: true};
 }
 }
 
 
@@ -98,11 +98,11 @@ export async function cachedProductRequest<
   TData = unknown,
   TData = unknown,
   TVariables extends OperationVariables = OperationVariables,
   TVariables extends OperationVariables = OperationVariables,
 >(
 >(
-  productId: string,
+  // productId: string,
   query: DocumentNode,
   query: DocumentNode,
   variables?: TVariables,
   variables?: TVariables,
 ): Promise<GraphqlRequestResult<TData>> {
 ): Promise<GraphqlRequestResult<TData>> {
-  const config = getProductCacheConfig(productId);
+  const config = getProductCacheConfig();
   return graphqlRequest<TData, TVariables>(query, variables, config);
   return graphqlRequest<TData, TVariables>(query, variables, config);
 }
 }