Skip to content

Commit

Permalink
cache home as well
Browse files Browse the repository at this point in the history
  • Loading branch information
peteror committed Nov 3, 2023
1 parent 78455ee commit cf0e4ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/routes/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,24 +146,26 @@ export const graphql: Handler = async function (req, res) {
/**
* Check if query is in the cache
*/
if (isMutationRequest === false && genericTypes != null && genericTypes.includes(operationName)) {
if (isMutationRequest === false){
// && genericTypes != null && genericTypes.includes(operationName)) {
let cacheKey = ''

/**
if (isPrivateAndCacheable) {
querySignature = await SHA256(authorizationHeader + content + variables)
defaultResponseHeaders[HTTPHeaders.fgScope] = Scope.AUTHENTICATED
} else {
querySignature = await SHA256(content + variables)
}
*/
if (operationName == 'Home') {

/**if (operationName == 'Home') {
querySignature = await SHA256(authorizationHeader + content + variables)
defaultResponseHeaders[HTTPHeaders.fgScope] = Scope.AUTHENTICATED
} else {
querySignature = await SHA256(content + variables)
}
}*/

const cacheUrl = new URL(req.url)
console.log (variables.toString())

if (originalBody.operationName) {
cacheKey += originalBody.operationName + '/'
Expand Down
2 changes: 1 addition & 1 deletion wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SCOPE = "AUTHENTICATED"
IGNORE_ORIGIN_CACHE_HEADERS = "1"
DEFAULT_TTL = "600"
SWR = "30"
PRIVATE_TYPES = "userOrders,accountAddresses"
PRIVATE_TYPES = "userOrders,accountAddresses,checkout,giftCardDetails,giftCardDetails,previouslyOrderedProductsIds"
GENERIC_TYPES = "ShippingMethodsFetchAll,productsList,Home,categories,collections,promotedProductsList,productDetails,getProductsForSubcategoriesWithPromoted,getHomeCategories,getPromotionalBanner,getProductCountForChannel,getMainProductCategories,productsCountByChannel"
AUTH_DIRECTIVE = ""
APQ_TTL = "30"
Expand Down

0 comments on commit cf0e4ee

Please sign in to comment.