yeahh buddy
This commit is contained in:
23
server/routes/me.get.ts
Normal file
23
server/routes/me.get.ts
Normal 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;
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user