auth required works
This commit is contained in:
@@ -2,8 +2,14 @@
|
|||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
// this one requires auth
|
// this one requires auth
|
||||||
//const login = fetch("http://127.0.0.1:81/login");
|
//const login = fetch("http://127.0.0.1:81/login");
|
||||||
|
console.log(await readBody(event))
|
||||||
|
|
||||||
const session = await getUserSession(event)
|
const session = await getUserSession(event)
|
||||||
if (session.secure!.user_id == undefined)
|
console.log(session)
|
||||||
throw createError({ statusCode: 401 });
|
try {
|
||||||
|
const userId = session.secure!.user_id;
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
throw createError({ status: 401 })
|
||||||
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user