mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
29a8650375
* feat: expose APIContext from the second handler param * refactor: use second param from test * chore: changeset * edit: minor -> patch * edit: apiContext -> context Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> * refactor: apiContext -> context Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> * refactor: apiContext -> context Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> --------- Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
463 B
463 B
astro |
---|
patch |
Deprecate the getApiContext()
function. API Context can now be accessed from the second parameter to your Action handler()
:
// src/actions/index.ts
import {
defineAction,
z,
- getApiContext,
} from 'astro:actions';
export const server = {
login: defineAction({
input: z.object({ id: z.string }),
+ handler(input, context) {
const user = context.locals.auth(input.id);
return user;
}
}),
}