Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
yunusefendi52 committed Mar 31, 2024
1 parent 66fa2d0 commit 0055cbf
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions server/middleware/auth-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ 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: 0 }
}
// 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 }
})

0 comments on commit 0055cbf

Please sign in to comment.