-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(actions): getActionPath() #12721
Conversation
🦋 Changeset detectedLatest commit: a71b0e5 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
CodSpeed Performance ReportMerging #12721 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
The name of the actual function will probably change after docs feedback |
await fetch(getActionPath(actions.like), { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: 'Bearer YOUR_TOKEN' | ||
}, | ||
body: JSON.stringify({ id: 'YOUR_ID' }), | ||
keepalive: true | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this! I think it's definitely worth noting that actions do not return plain JSON. They return values that are parsable by the devalue
library. I suggest using the deserializeActionResult()
utility from astro:actions
for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good call thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bholmesdev -- is showing using deserializeActionResult()
in this context concise? I realized we only have a short API reference sentence for this (no example usage), and no example using this anywhere in docs. (So, I'm not sure if this can be shown quickly or not.)
This would be a great addition to the actual docs (where I don't really care if it's concise or not), and if it's easy to do here, would also be a great place to put it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changeset review for docs! Great work, @florian-lefebvre !
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment left for @florian-lefebvre as an optional type of improvement, but non-blocking and approving for docs!
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Changes
getActionPath()
helperTesting
Adds a test case
Docs
Changeset and withastro/docs#10353