16 lines
427 B
TypeScript
16 lines
427 B
TypeScript
import type {Context} from "hono";
|
|
import type {ContentfulStatusCode} from "hono/utils/http-status";
|
|
|
|
export const apiReturn = async (
|
|
c: Context,
|
|
success: boolean,
|
|
message: string,
|
|
data: any,
|
|
code: ContentfulStatusCode
|
|
): Promise<Response> => {
|
|
/**
|
|
* This is just a global return function to reduce constacnt typing the same thing lol
|
|
*/
|
|
return c.json({success, message, data}, code);
|
|
};
|