You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have just created a new macro name `isSignIn` that accepts a `boolean` value, if it is true, then we add an `onBeforeHandle` event that executes **after validation but before the main handler**, allowing us to extract authentication logic here.
1201
1199
1202
1200
To use the macro, simply specify `isSignIn: true` as follows:
1203
-
// @errors: 2538
1204
-
// @filename: user.ts
1205
-
import { Elysia, t } from 'elysia'
1201
+
1206
1202
```ts twoslash [user.ts]
1207
1203
// @errors: 2538
1208
1204
import { Elysia, t } from'elysia'
@@ -1341,9 +1337,6 @@ Unlike `decorate` and `store`, resolve is defined at the `beforeHandle` stage or
1341
1337
1342
1338
This ensures that the property like `cookie: 'session'` exists before creating a new property.
1343
1339
1344
-
// @errors: 2538
1345
-
// @filename: user.ts
1346
-
import { Elysia, t } from 'elysia'
1347
1340
```ts twoslash [user.ts]
1348
1341
// @errors: 2538
1349
1342
import { Elysia, t } from'elysia'
@@ -1563,9 +1556,6 @@ export const user = new Elysia({ prefix: '/user' })
1563
1556
1564
1557
Alternatively, if we have multiple `scoped` defined, we could use `as` to cast multiple life-cycles instead.
0 commit comments