Skip to content

Commit

Permalink
🔀 Merge #2034 into deploy/main
Browse files Browse the repository at this point in the history
  • Loading branch information
nwingt committed Jan 24, 2025
2 parents 4f64acb + b771052 commit 5fdb85e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/constant/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,4 +471,4 @@ export const SEARCH_SUGGESTIONS = [
export const CHRISTMAS_CAMPAIGN_MIN_SPEND = 9;
export const CHRISTMAS_CAMPAIGN_COUPON = 'XMASREAD';

export const BOOKSTORE_CMS_CACHE_RESET_TIMESTAMP = 1737475200;
export const BOOKSTORE_CMS_CACHE_RESET_TIMESTAMP = 1737561600;
7 changes: 5 additions & 2 deletions src/server/api/routes/bookstore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ router.get('/bookstore/products', async (req, res, next) => {

const result = await fetchAirtableCMSProductsByTagId(tagId, {
pageSize,
offset,
offset: Array.isArray(offset) ? offset.join('/') : offset,
});

if (!IS_TESTNET) {
Expand All @@ -55,7 +55,10 @@ router.get('/bookstore/products', async (req, res, next) => {

res.json(result);
} catch (error) {
if (error.response?.status === 422) {
if (
error.response?.status === 422 &&
error.response?.data?.error?.type === 'VIEW_NAME_NOT_FOUND'
) {
res.status(404).send('TAG_NOT_FOUND');
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/util/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,14 +612,14 @@ export const fetchBookstoreCMSTags = ({ limit = 100 } = {}) =>

export const fetchBookstoreCMSProductsByTagId = (
tagId,
{ offset, t = BOOKSTORE_CMS_CACHE_RESET_TIMESTAMP, limit = 100 } = {}
{ offset, t = BOOKSTORE_CMS_CACHE_RESET_TIMESTAMP, limit = 30 } = {}
) => {
const qsPayload = {
tag: tagId,
limit,
t,
};
if (offset) qsPayload.offset = offset;
if (offset) qsPayload.offset = offset.split('/');
return `${EXTERNAL_HOST}/api/bookstore/products?${querystring.stringify(
qsPayload
)}`;
Expand Down

0 comments on commit 5fdb85e

Please sign in to comment.