Skip to content

Commit

Permalink
fix: Domains with www weren't loading keywords.
Browse files Browse the repository at this point in the history
resolves: #8
  • Loading branch information
towfiqi committed Dec 1, 2022
1 parent 1ed298f commit 3d1c690
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pages/api/keywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const getKeywords = async (req: NextApiRequest, res: NextApiResponse<KeywordsGet
if (!req.query.domain && typeof req.query.domain !== 'string') {
return res.status(400).json({ error: 'Domain is Required!' });
}
const domain = (req.query.domain as string).replace('-', '.');
const domain = (req.query.domain as string).replaceAll('-', '.');

try {
const allKeywords:Keyword[] = await Keyword.findAll({ where: { domain } });
const keywords: KeywordType[] = parseKeywords(allKeywords.map((e) => e.get({ plain: true })));
Expand Down

0 comments on commit 3d1c690

Please sign in to comment.