mirror of
https://github.com/pheralb/svgl.git
synced 2025-02-06 06:58:04 +08:00
⚒️ Add .json to the import.
This commit is contained in:
parent
f2cfedcbb0
commit
efd2fbbe26
@ -1,4 +1,4 @@
|
||||
import db from "data/svgs";
|
||||
import db from "data/svgs.json";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { SvgData } from "@/interfaces/svgData";
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import db from "data/svgs";
|
||||
import db from "data/svgs.json";
|
||||
|
||||
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
// Get unique categories:
|
||||
|
@ -1,4 +1,4 @@
|
||||
import db from "data/svgs";
|
||||
import db from "data/svgs.json";
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
@ -14,7 +14,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
if (q) {
|
||||
const results = db.filter((product) => {
|
||||
const { title } = product;
|
||||
return title;
|
||||
return title.toLowerCase().includes(q.toString());
|
||||
});
|
||||
return res.status(200).json(results);
|
||||
}
|
||||
@ -23,11 +23,11 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
if (c) {
|
||||
const results = db.filter((product) => {
|
||||
const { category } = product;
|
||||
return category;
|
||||
return category.toLowerCase().includes(q.toString());
|
||||
});
|
||||
return res.status(200).json(results);
|
||||
}
|
||||
|
||||
// ✖ Error ->
|
||||
res.status(400).json({ info: "Error: api query not found." });
|
||||
res.status(400).json({ info: "[/api/search] Error: api query not found." });
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user