Skip to content

Commit

Permalink
feat: use ETag only in IPFS
Browse files Browse the repository at this point in the history
  • Loading branch information
solidovic committed Jan 16, 2024
1 parent 3f684f7 commit a260d60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ export const getStaticProps: GetStaticProps<
if (process.env.IPFS_MODE) {
return {
props: {
faqWithMetaStakePage: await getFaqSSR(FAQ_STAKE_PAGE_PATH),
faqWithMetaWrapPage: await getFaqSSR(FAQ_WRAP_AND_UNWRAP_PAGE_PATH),
faqWithMetaStakePage: await getFaqSSR(FAQ_STAKE_PAGE_PATH, false),
faqWithMetaWrapPage: await getFaqSSR(
FAQ_WRAP_AND_UNWRAP_PAGE_PATH,
false,
),
faqWithMetaWithdrawalsPageRequest: await getFaqSSR(
FAQ_WITHDRAWALS_PAGE_REQUEST_TAB_PATH,
false,
),
faqWithMetaWithdrawalsPageClaim: await getFaqSSR(
FAQ_WITHDRAWALS_PAGE_CLAIM_TAB_PATH,
false,
),
},
};
Expand Down
7 changes: 5 additions & 2 deletions utilsApi/faq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export const fetchFaqSSR = async (
return resp;
};

export const getFaqSSR = async (path: string): Promise<FaqWithMeta | null> => {
export const getFaqSSR = async (
path: string,
excludeETag = true,
): Promise<FaqWithMeta | null> => {
try {
const rawFaqResp = await fetchFaqSSR(path);

Expand All @@ -47,7 +50,7 @@ export const getFaqSSR = async (path: string): Promise<FaqWithMeta | null> => {
return {
pageFAQ: parsedFaq,
path,
eTag: rawFaqResp?.headers?.get('ETag'),
eTag: !excludeETag ? rawFaqResp?.headers?.get('ETag') : null,
};
} catch (err) {
console.error(
Expand Down

0 comments on commit a260d60

Please sign in to comment.