24 lines
No EOL
676 B
TypeScript
24 lines
No EOL
676 B
TypeScript
import Elysia from "elysia";
|
|
import { verifyAuth } from "../../middlewares/auth.middlewares";
|
|
import { getAllDesign } from "./design.controller";
|
|
|
|
export const designRoute = new Elysia({
|
|
prefix: "/design",
|
|
tags: ["Design"],
|
|
detail: {
|
|
description: "Routes for managing designs",
|
|
}
|
|
}).derive(async ({ cookie }) => {
|
|
const authData = await verifyAuth(cookie);
|
|
return { authData }; // Inject into context
|
|
})
|
|
|
|
designRoute.get("/", async ({ authData }) => {
|
|
if (authData.status !== 200)
|
|
return authData;
|
|
else {
|
|
const token = authData.token;
|
|
const response = await getAllDesign(token);
|
|
return response;
|
|
}
|
|
}) |