Skip to content

Commit

Permalink
make it simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
guyutongxue committed Jan 24, 2025
1 parent fc5c7f1 commit e1423ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/v2/data/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export default async function handler(req, res) {
if (id.endsWith(".webp")) {
let query = id.slice(0, -5);
if (query && Number.isNaN(Number(query))) {
const found = [...characters, ...actionCards].filter((obj) =>
const found = [...characters, ...actionCards].find((obj) =>
obj.name.includes(query),
);
if (found.length >= 1) {
query = String(found[0].id);
if (found) {
query = String(found.id);
} else {
res.status(404).send("Not found");
return;
Expand Down

0 comments on commit e1423ff

Please sign in to comment.