From 83eb2e6df3f891c34643928c230c7603ea986430 Mon Sep 17 00:00:00 2001 From: Sacha STAFYNIAK Date: Tue, 25 Aug 2020 18:52:07 +0200 Subject: [PATCH] Add userUpdated hook (#37) * add userUpdated hook * Update hooks.md * Update hooks.md --- docs/content/en/hooks.md | 41 +++++++++++++++++++++++++++++++++++++++- lib/plugin.js | 1 + 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/docs/content/en/hooks.md b/docs/content/en/hooks.md index d455ec0d..05123071 100644 --- a/docs/content/en/hooks.md +++ b/docs/content/en/hooks.md @@ -17,4 +17,43 @@ export default ({ $strapi, app }) => { app.$toast.error(e.message) }) } -``` \ No newline at end of file +``` + +### `userUpdated` + +You can register an `userUpdated` hook to force refetch inside components: + + +```vue{}[components/navbar.vue] + + + +``` diff --git a/lib/plugin.js b/lib/plugin.js index e2f3e035..b1ff6bdc 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -99,6 +99,7 @@ class Strapi extends Hookable { setUser (user) { this.user = user + this.callHook('userUpdated', user) } find (entity, searchParams) {