Files
yt2mp3/server/routes/me.get.ts
2026-01-20 17:14:21 +00:00

24 lines
690 B
TypeScript

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;
})