mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-04 09:06:01 +00:00
added format command and added trailing commas to reduce conflicts
This commit is contained in:
@@ -7,7 +7,7 @@ export type FlashMessageType = "error" | "warning" | "success" | "info";
|
||||
export function addFlashMessage(c: Context, message: string, type: FlashMessageType = "info") {
|
||||
if (c.req.header("Accept")?.includes("text/html")) {
|
||||
setCookie(c, flash_key, JSON.stringify({ type, message }), {
|
||||
path: "/"
|
||||
path: "/",
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ function getCookieValue(name) {
|
||||
}
|
||||
|
||||
export function getFlashMessage(
|
||||
clear = true
|
||||
clear = true,
|
||||
): { type: FlashMessageType; message: string } | undefined {
|
||||
const flash = getCookieValue(flash_key);
|
||||
if (flash && clear) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { validator } from "hono/validator";
|
||||
|
||||
type Hook<T, E extends Env, P extends string> = (
|
||||
result: { success: true; data: T } | { success: false; errors: ValueError[] },
|
||||
c: Context<E, P>
|
||||
c: Context<E, P>,
|
||||
) => Response | Promise<Response> | void;
|
||||
|
||||
export function tbValidator<
|
||||
@@ -13,7 +13,7 @@ export function tbValidator<
|
||||
Target extends keyof ValidationTargets,
|
||||
E extends Env,
|
||||
P extends string,
|
||||
V extends { in: { [K in Target]: StaticDecode<T> }; out: { [K in Target]: StaticDecode<T> } }
|
||||
V extends { in: { [K in Target]: StaticDecode<T> }; out: { [K in Target]: StaticDecode<T> } },
|
||||
>(target: Target, schema: T, hook?: Hook<StaticDecode<T>, E, P>): MiddlewareHandler<E, P, V> {
|
||||
// Compile the provided schema once rather than per validation. This could be optimized further using a shared schema
|
||||
// compilation pool similar to the Fastify implementation.
|
||||
|
||||
Reference in New Issue
Block a user