17 lines
418 B
TypeScript
17 lines
418 B
TypeScript
import type { FastifyInstance } from "fastify";
|
|
|
|
export default async function Me(fastify: FastifyInstance) {
|
|
fastify.post("/", async (req, res) => {
|
|
res.header("Content-Type", "application/json");
|
|
|
|
if ("error" in req.token)
|
|
return res.code(400).send(req.token);
|
|
|
|
const { password, email, ...safeUser } = req.token.user;
|
|
return res.send({
|
|
...safeUser,
|
|
success: true,
|
|
});
|
|
});
|
|
}
|