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