From: shasderias Date: Sun, 3 Oct 2021 09:02:21 +0000 (+0800) Subject: docs: minor typo and grammar fixes (#697) X-Git-Tag: @pinia/nuxt@0.0.3~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c525a8aa81823799aa96a6fb5f579a0cc48f819;p=thirdparty%2Fvuejs%2Fpinia.git docs: minor typo and grammar fixes (#697) --- diff --git a/packages/docs/core-concepts/actions.md b/packages/docs/core-concepts/actions.md index aaa4a37b..c67a31b5 100644 --- a/packages/docs/core-concepts/actions.md +++ b/packages/docs/core-concepts/actions.md @@ -18,7 +18,7 @@ export const useStore = defineStore('main', { }) ``` -Like [getters](./getters.md), actions get access to the _whole store instance_ through `this` with **full typing (and autocompletion ✨) support**. **Unlike them, `actions` can be asynchronous**, you can `await` inside of them any API call or even other actions! Here is an examlpe using [Mande](https://github.com/posva/mande). Note the library you use doesn't matter as long as you get a `Promise`, you could even use the native `fetch` function (browser only): +Like [getters](./getters.md), actions get access to the _whole store instance_ through `this` with **full typing (and autocompletion ✨) support**. **Unlike them, `actions` can be asynchronous**, you can `await` inside of them any API call or even other actions! Here is an example using [Mande](https://github.com/posva/mande). Note the library you use doesn't matter as long as you get a `Promise`, you could even use the native `fetch` function (browser only): ```js import { mande } from 'mande' @@ -120,9 +120,9 @@ export default { ## Subscribing to actions -> [Give feedback about `$onAction()`](https://github.com/posva/pinia/issues/240) +> [Give feedback on `$onAction()`](https://github.com/posva/pinia/issues/240) -It is possible to observe actions and their outcome with `store.$onAction()`. The callback passed to it is executed before the action itself. `after` handle promises and allows you to change the returned value of the action. `onError` allows you to stop the error from propagating. These are useful for tracking errors at runtime, similar to [what is explaining in Vue docs](https://v3.vuejs.org/guide/tooling/deployment.html#tracking-runtime-errors). +It is possible to observe actions and their outcome with `store.$onAction()`. The callback passed to it is executed before the action itself. `after` handle promises and allows you to change the returned value of the action. `onError` allows you to stop the error from propagating. These are useful for tracking errors at runtime, similar to [this tip in the Vue docs](https://v3.vuejs.org/guide/tooling/deployment.html#tracking-runtime-errors). Here is an example that logs before running actions and after they resolve/reject.