@@ -36,13 +36,13 @@ namespace ShopHooks {
3636 } ;
3737
3838 export const useShopClient = ( ) => {
39- const { shopApiDomain, shopApiCSRFCookieName, shopApiTimeout } = useShopContext ( ) ;
40- return new ShopAPIClient ( shopApiDomain , shopApiCSRFCookieName , shopApiTimeout ) ;
39+ const { shopApiDomain, shopApiCSRFCookieName, shopApiTimeout, language } = useShopContext ( ) ;
40+ return new ShopAPIClient ( shopApiDomain , shopApiCSRFCookieName , shopApiTimeout , language ) ;
4141 } ;
4242
4343 export const useUserStatus = ( client : ShopAPIClient ) =>
4444 useSuspenseQuery ( {
45- queryKey : QUERY_KEYS . USER ,
45+ queryKey : [ client . language , ... QUERY_KEYS . USER ] ,
4646 queryFn : ShopAPIs . retrieveUserInfo ( client ) ,
4747 retry : 3 ,
4848 } ) ;
@@ -71,13 +71,13 @@ namespace ShopHooks {
7171
7272 export const useProducts = ( client : ShopAPIClient , qs ?: ShopSchemas . ProductListQueryParams ) =>
7373 useSuspenseQuery ( {
74- queryKey : [ ...QUERY_KEYS . PRODUCT_LIST , qs ? JSON . stringify ( qs ) : "" ] ,
74+ queryKey : [ client . language , ...QUERY_KEYS . PRODUCT_LIST , qs ? JSON . stringify ( qs ) : "" ] ,
7575 queryFn : ( ) => ShopAPIs . listProducts ( client ) ( qs ) ,
7676 } ) ;
7777
7878 export const useCart = ( client : ShopAPIClient ) =>
7979 useSuspenseQuery ( {
80- queryKey : QUERY_KEYS . CART_INFO ,
80+ queryKey : [ client . language , ... QUERY_KEYS . CART_INFO ] ,
8181 queryFn : ShopAPIs . retrieveCart ( client ) ,
8282 } ) ;
8383
@@ -111,7 +111,7 @@ namespace ShopHooks {
111111
112112 export const useOrders = ( client : ShopAPIClient ) =>
113113 useSuspenseQuery ( {
114- queryKey : QUERY_KEYS . ORDER_LIST ,
114+ queryKey : [ client . language , ... QUERY_KEYS . ORDER_LIST ] ,
115115 queryFn : ShopAPIs . listOrders ( client ) ,
116116 } ) ;
117117
0 commit comments