mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 13:59:16 +01:00
fix(api): 🐛 Add JSON support to every form that doesn't have a file parameter
This commit is contained in:
parent
9f0eab03f2
commit
4713d0f93f
5 changed files with 12 additions and 6 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { applyConfig, auth, handleZodError } from "@api";
|
||||
import { applyConfig, auth, handleZodError, jsonOrForm } from "@api";
|
||||
import { zValidator } from "@hono/zod-validator";
|
||||
import { errorResponse, jsonResponse } from "@response";
|
||||
import { and, eq } from "drizzle-orm";
|
||||
|
|
@ -33,6 +33,7 @@ export default (app: Hono) =>
|
|||
app.on(
|
||||
meta.allowedMethods,
|
||||
meta.route,
|
||||
jsonOrForm(),
|
||||
zValidator("param", schemas.param, handleZodError),
|
||||
zValidator("form", schemas.form, handleZodError),
|
||||
auth(meta.auth),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { applyConfig, auth, handleZodError, qs } from "@api";
|
||||
import { applyConfig, auth, handleZodError, jsonOrForm, qs } from "@api";
|
||||
import { zValidator } from "@hono/zod-validator";
|
||||
import { errorResponse, jsonResponse } from "@response";
|
||||
import { and, eq, inArray } from "drizzle-orm";
|
||||
|
|
@ -70,7 +70,7 @@ export default (app: Hono) =>
|
|||
app.on(
|
||||
meta.allowedMethods,
|
||||
meta.route,
|
||||
qs(),
|
||||
jsonOrForm(),
|
||||
zValidator("param", schemas.param, handleZodError),
|
||||
zValidator("form", schemas.form, handleZodError),
|
||||
auth(meta.auth),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { applyConfig, auth, handleZodError, qs } from "@api";
|
||||
import { applyConfig, auth, handleZodError, jsonOrForm, qs } from "@api";
|
||||
import { zValidator } from "@hono/zod-validator";
|
||||
import { errorResponse, jsonResponse } from "@response";
|
||||
import type { Hono } from "hono";
|
||||
|
|
@ -61,7 +61,7 @@ export default (app: Hono) =>
|
|||
app.on(
|
||||
meta.allowedMethods,
|
||||
meta.route,
|
||||
qs(),
|
||||
jsonOrForm(),
|
||||
zValidator("form", schemas.form, handleZodError),
|
||||
auth(meta.auth),
|
||||
async (context) => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { randomBytes } from "node:crypto";
|
||||
import { applyConfig, handleZodError } from "@api";
|
||||
import { applyConfig, handleZodError, jsonOrForm } from "@api";
|
||||
import { zValidator } from "@hono/zod-validator";
|
||||
import { response } from "@response";
|
||||
import type { Hono } from "hono";
|
||||
|
|
@ -76,6 +76,7 @@ export default (app: Hono) =>
|
|||
app.on(
|
||||
meta.allowedMethods,
|
||||
meta.route,
|
||||
jsonOrForm(),
|
||||
zValidator("query", schemas.query, handleZodError),
|
||||
zValidator("form", schemas.form, handleZodError),
|
||||
async (context) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue