diff --git a/src/pages/store/index.vue b/src/pages/store/index.vue index 57e9fd8d9..44ef16a72 100644 --- a/src/pages/store/index.vue +++ b/src/pages/store/index.vue @@ -953,11 +953,11 @@ export default { }, localizedBookstoreCMSTags() { - const isChinese = this.$i18n.locale === 'zh-Hant'; + const lang = this.$i18n.locale === 'zh-Hant' ? 'zh' : 'en'; return this.bookstoreCMSTags.map(tag => ({ ...tag, - name: isChinese ? tag.nameZh : tag.nameEn, - description: isChinese ? tag.descriptionZh : tag.descriptionEn, + name: tag.name[lang], + description: tag.description[lang], })); }, bookstoreTagButtons() { diff --git a/src/server/api/routes/bookstore/index.js b/src/server/api/routes/bookstore/index.js index 9fb6367b7..e74cf5904 100644 --- a/src/server/api/routes/bookstore/index.js +++ b/src/server/api/routes/bookstore/index.js @@ -13,8 +13,10 @@ const router = Router(); router.get('/bookstore/tags', async (req, res, next) => { try { + const { limit: pageSize, offset } = req.query; const result = await fetchAirtableCMSTags({ - pageSize: 100, + pageSize, + offset, }); if (!IS_TESTNET) { diff --git a/src/server/api/util/airtable.js b/src/server/api/util/airtable.js index 5fdfa643a..a3de2d93c 100644 --- a/src/server/api/util/airtable.js +++ b/src/server/api/util/airtable.js @@ -89,19 +89,21 @@ async function fetchAirtableCMSTags({ pageSize = 100, offset }) { const normalizedRecords = results.data.records.map(({ fields }) => { const id = fields.ID; - const name = fields.Name; + const nameZh = fields.Name; const nameEn = fields['Name (Eng)']; - const description = fields.Description; + const descriptionZh = fields.Description; const descriptionEn = fields['Description (Eng)']; const isPublic = fields.Public; return { id, - name, - nameZh: name, - nameEn, - description, - descriptionZh: description, - descriptionEn, + name: { + zh: nameZh, + en: nameEn, + }, + description: { + zh: descriptionZh, + en: descriptionEn, + }, isPublic, }; });