From 4fcbecc94dc0cf9161460838d76df70bad5fcf6f Mon Sep 17 00:00:00 2001 From: hoilc Date: Tue, 17 Mar 2020 12:06:59 +0800 Subject: [PATCH] fix: PNAS parameter & default value (#4258) --- lib/routes/pnas/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/routes/pnas/index.js b/lib/routes/pnas/index.js index cddb3ae78..6feb7602a 100644 --- a/lib/routes/pnas/index.js +++ b/lib/routes/pnas/index.js @@ -4,13 +4,13 @@ const got = require('@/utils/got'); module.exports = async (ctx) => { const baseUrl = `https://www.pnas.org`; - const tid = ctx.params.tid; + const topic = ctx.params.topic; let url = `${baseUrl}/content/early/recent`; - if (tid !== 'latest') { - url = `${baseUrl}/content/by/section/${ctx.params.tid}`; + if (topic && topic !== 'latest') { + url = `${baseUrl}/content/by/section/${ctx.params.topic}`; } else { - ctx.params.tid = 'Latest Research'; + ctx.params.topic = 'Latest Research'; } const res = await got.get(url); @@ -59,7 +59,7 @@ module.exports = async (ctx) => { }) ); ctx.state.data = { - title: `PNAS | ${ctx.params.tid}`, + title: `PNAS | ${ctx.params.topic}`, link: url, item: out, };