ash_graphql/documentation/topics/modifying-the-resolution.md
Zach Daniel 49c6534d73 improvement: generic action support
docs: better docs
2023-09-15 13:45:12 -04:00

10 lines
693 B
Markdown

# Modifying the Resolution
Using the `modify_resolution` option, you can alter the Absinthe resolution.
`modify_resoltion` is an MFA that will be called with the resolution, the query, and the result of the action as the first three arguments. Must return a new absinthe resolution.
This can be used to implement things like setting cookies based on resource actions. A method of using resolution context
for that is documented here: https://hexdocs.pm/absinthe_plug/Absinthe.Plug.html#module-before-send
*Important* if you are modifying the context in a query, then you should also set `as_mutation?` to true and represent this in your graphql as a mutation. See `as_mutation?` for more.