Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
yunusefendi52 committed Mar 31, 2024
1 parent a9c42d7 commit a949d0d
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions server/middleware/auth-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ declare module 'h3' {


export default defineEventHandler((event) => {
// const appAuth = getCookie(event, 'app-auth')
// if (appAuth) {
// const verifiedData = jsonwebtoken.verify(appAuth, JWT_KEY)
// // if (!verifiedData) {
// // deleteCookie(event, 'app-auth')
// // }
// // @ts-ignore
// const userId = verifiedData.userId
// event.context.auth = { userId: userId }
// } else {
// }
event.context.auth = { userId: 1 }
const appAuth = getCookie(event, 'app-auth')
if (appAuth) {
const verifiedData = jsonwebtoken.verify(appAuth, JWT_KEY)
// if (!verifiedData) {
// deleteCookie(event, 'app-auth')
// }
// @ts-ignore
const userId = verifiedData.userId
event.context.auth = { userId: userId }
} else {
console.log('user not logged in')
event.context.auth = { userId: 1 }
}
})

0 comments on commit a949d0d

Please sign in to comment.