diff --git a/api/src/server/v1/index.ts b/api/src/server/v1/index.ts index f5f0f4227c..0a73885480 100644 --- a/api/src/server/v1/index.ts +++ b/api/src/server/v1/index.ts @@ -101,11 +101,8 @@ const app = new Hono() // FIXME: Remove when packaging script reworked return word && word.usage_category !== "sandbox" - ? c.json({ ok: true as const, data: word }) - : c.json( - { ok: false as const, message: `Could not find the word ${c.req.param("word")}` }, - 400, - ); + ? c.json({ data: word }) + : c.json({ message: `Could not find the word ${c.req.param("word")}` }, 400); }, ) @@ -129,10 +126,9 @@ const app = new Hono() const word = (await rawData).words[c.req.param("word")]; // FIXME: Remove when packaging script reworked return word && word.usage_category === "sandbox" - ? c.json({ ok: true as const, data: word }) + ? c.json({ data: word }) : c.json( { - ok: false as const, message: `Could not find the sandbox word "${c.req.param("word")}"`, }, 400, @@ -153,8 +149,8 @@ const app = new Hono() const sign = (await rawData).fingerspelling[c.req.param("sign")]; return sign - ? c.json({ ok: true as const, data: sign }) - : c.json({ ok: false as const, message: `Could not find a sign named ${sign}` }, 400); + ? c.json({ data: sign }) + : c.json({ message: `Could not find a sign named ${sign}` }, 400); }, ) @@ -171,8 +167,8 @@ const app = new Hono() const sign = (await rawData).signs[c.req.param("sign")]; return sign - ? c.json({ ok: true as const, data: sign }) - : c.json({ ok: false as const, message: `Could not find a sign named ${sign}` }, 400); + ? c.json({ data: sign }) + : c.json({ message: `Could not find a sign named ${sign}` }, 400); }, ) @@ -184,8 +180,8 @@ const app = new Hono() const font = (await rawData).fonts[c.req.param("font")]; return font - ? c.json({ ok: true as const, data: font }) - : c.json({ ok: false as const, message: `Could not find a font named ${font}` }, 400); + ? c.json({ data: font }) + : c.json({ message: `Could not find a font named ${font}` }, 400); }) .get("/languages", async (c) => { @@ -201,11 +197,8 @@ const app = new Hono() const langId = langIdCoalesce(language, languages); return langId - ? c.json({ ok: true as const, data: languages[langId]! }) - : c.json( - { ok: false as const, message: `Could not find a language named ${language}` }, - 400, - ); + ? c.json({ data: languages[langId]! }) + : c.json({ message: `Could not find a language named ${language}` }, 400); }, );