From: Eduardo San Martin Morote Date: Wed, 31 Mar 2021 09:48:03 +0000 (+0200) Subject: docs: clarify nuxt context example X-Git-Tag: v2.0.0-alpha.9~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4839bc976cbd527e5f805bd5fc8bf7be4e56f214;p=thirdparty%2Fvuejs%2Fpinia.git docs: clarify nuxt context example --- diff --git a/docs/ssr/nuxt.md b/docs/ssr/nuxt.md index 561a894e..404fd5cd 100644 --- a/docs/ssr/nuxt.md +++ b/docs/ssr/nuxt.md @@ -49,11 +49,12 @@ You can also use [the context](https://nuxtjs.org/docs/2.x/internals-glossary/co ```js defineStore({ - id: 'main', + id: 'cart', actions: { - login() { - if (!canLogin()) { + purchase() { + const user = useUserStore() + if (!user.isAuthenticated()) { this.$nuxt.redirect('/login') } },