24 lines
694 B
TypeScript
24 lines
694 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({ statusCode: 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;
|
|
})
|