If search query is empty, redirect to front page

parent 15b8569a
...@@ -15,7 +15,7 @@ const router: Router = Router(); ...@@ -15,7 +15,7 @@ const router: Router = Router();
* Index * Index
*/ */
router.get("/", (req: Request, res: Response, next: NextFunction) => { router.get("/", (req: Request, res: Response, next: NextFunction) => {
const query = req.query.q; const query: string = req.query.q;
if(query) { if(query) {
if(isIp(query)) { if(isIp(query)) {
...@@ -68,7 +68,7 @@ router.get("/", (req: Request, res: Response, next: NextFunction) => { ...@@ -68,7 +68,7 @@ router.get("/", (req: Request, res: Response, next: NextFunction) => {
} }
} }
} else { } else {
next(); res.redirect(301, `/`);
} }
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment