yeahh buddy

This commit is contained in:
2026-01-20 17:14:21 +00:00
parent 16e5d79460
commit 9670293b51

23
server/routes/me.get.ts Normal file
View File

@@ -0,0 +1,23 @@
export default defineEventHandler(async (event) => {
const config = await useRuntimeConfig(event)
//const body = await readBody(event)
const session = await getUserSession(event)
// @ts-ignore
const userId = session.secure?.user_id;
if (userId == undefined || userId == null)
throw createError({ status: 401 })
const r = await fetch(config.fastapi_url + "/me" + '?' +
new URLSearchParams({ id: userId }))
let body = await r.json();
try { delete body["id"]; } catch {}
try { delete body["password"]; } catch {}
try { delete body["created_at"] } catch {}
try { delete body["updated_at"]; } catch {}
return body;
})