mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-10 04:19:32 +00:00
docs: fix plugin after hook handler example (#3372)
This commit is contained in:
committed by
GitHub
parent
ea76ad1be6
commit
dbaa342269
@@ -242,7 +242,7 @@ const myPlugin = ()=>{
|
|||||||
matcher: (context)=>{
|
matcher: (context)=>{
|
||||||
return context.headers.get("x-my-header") === "my-value"
|
return context.headers.get("x-my-header") === "my-value"
|
||||||
},
|
},
|
||||||
handler: createAuthMiddleware(async(ctx)=>{
|
handler: createAuthMiddleware(async (ctx)=>{
|
||||||
//do something before the request
|
//do something before the request
|
||||||
return {
|
return {
|
||||||
context: ctx // if you want to modify the context
|
context: ctx // if you want to modify the context
|
||||||
@@ -253,11 +253,11 @@ const myPlugin = ()=>{
|
|||||||
matcher: (context)=>{
|
matcher: (context)=>{
|
||||||
return context.path === "/sign-up/email"
|
return context.path === "/sign-up/email"
|
||||||
},
|
},
|
||||||
handler: async(ctx)=>{
|
handler: createAuthMiddleware(async (ctx)=>{
|
||||||
return ctx.json({
|
return ctx.json({
|
||||||
message: "Hello World"
|
message: "Hello World"
|
||||||
}) // if you want to modify the response
|
}) // if you want to modify the response
|
||||||
}
|
})
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
} satisfies BetterAuthPlugin
|
} satisfies BetterAuthPlugin
|
||||||
|
|||||||
Reference in New Issue
Block a user