Skip to content

Commit

Permalink
Fix params of serpapi
Browse files Browse the repository at this point in the history
  • Loading branch information
memochou1993 committed Feb 3, 2024
1 parent 394bde4 commit 82ad571
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@ LINE_CHANNEL_SECRET=
SERPAPI_TIMEOUT=
SERPAPI_API_KEY=
SERPAPI_LOCATION=
SERPAPI_LANG=
3 changes: 1 addition & 2 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ const config = Object.freeze({
LINE_CHANNEL_SECRET: env.LINE_CHANNEL_SECRET || null,
SERPAPI_TIMEOUT: env.SERPAPI_TIMEOUT || env.APP_API_TIMEOUT,
SERPAPI_API_KEY: env.SERPAPI_API_KEY || null,
SERPAPI_LOCATION: env.SERPAPI_LOCATION || 'Taiwan',
SERPAPI_LANG: env.SERPAPI_LANG || 'lang_zh-TW',
SERPAPI_LOCATION: env.SERPAPI_LOCATION || 'tw',
});

export default config;
6 changes: 2 additions & 4 deletions services/serpapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ client.interceptors.response.use(handleFulfilled, (err) => {
});

const search = ({
lr = config.SERPAPI_LOCATION,
location = config.SERPAPI_LOCATION,
gl = config.SERPAPI_LOCATION,
q,
}) => client.get('/search', {
params: {
lr,
location,
gl,
q,
},
});
Expand Down

0 comments on commit 82ad571

Please sign in to comment.