Replies: 3 comments 6 replies
-
Oh, this is a nice suggestion! I wonder if we can expand our current That said, I can see |
Beta Was this translation helpful? Give feedback.
-
I need this too. Also, it would be great if GET was the default when no input arguments are needed. |
Beta Was this translation helpful? Give feedback.
-
Any updates on this? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Currently, Astro Actions can be used to send data and perform actions on the server via POST requests.
However, users might want to get data from the server while leveraging browser and server caching, which requires a GET request.
Background & Motivation
I am working on a project and wanted to use astro:actions for its tRPC-like ergonomics. My project contains several framework components which then obtain data from the server utilizing actions.
Those data requests could be cached so concurrent users don't have to reexecute the action, but given all actions are POST, they must reevaluate.
A use case I immediately have is to allow access to collection content on my framework components without sending the entire collection as a prop.
Goals
defineAction
to indicate the use of the GET method (such as with a new propertymethod: 'get'
;JSON.stringify
and send as theinput
query parameter.Note
It must be documented that there would be a size limitation on input parameters. However, I do not see it as an impediment given GET API inputs are usually related to filtering and therefore succinct.
Example
Beta Was this translation helpful? Give feedback.
All reactions