mirror of
https://github.com/romancm/gamebrary
synced 2024-11-10 13:44:16 +00:00
make platform filtering optional
This commit is contained in:
parent
ecd50f95ce
commit
daa4df07ce
1 changed files with 2 additions and 2 deletions
|
@ -70,7 +70,7 @@ exports.search = functions.https.onRequest((req, res) => {
|
||||||
|
|
||||||
const { search, platform, token } = req.query;
|
const { search, platform, token } = req.query;
|
||||||
|
|
||||||
const missingFields = [search, platform, token].filter((field) => !field).length > 0;
|
const missingFields = [search, token].filter((field) => !field).length > 0;
|
||||||
|
|
||||||
if (missingFields) {
|
if (missingFields) {
|
||||||
return res.status(400).json({ error: 'missing required params (search OR platform OR token)' });
|
return res.status(400).json({ error: 'missing required params (search OR platform OR token)' });
|
||||||
|
@ -80,7 +80,7 @@ exports.search = functions.https.onRequest((req, res) => {
|
||||||
search "${search}";
|
search "${search}";
|
||||||
fields id,name,slug,rating,release_dates.*,name,cover.image_id;
|
fields id,name,slug,rating,release_dates.*,name,cover.image_id;
|
||||||
limit 50;
|
limit 50;
|
||||||
where platforms = (${platform});
|
${platform ? `where platforms = (${platform});` : ''}
|
||||||
`
|
`
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
|
|
Loading…
Reference in a new issue