From 15f5c222438b81559d987cc9c4b90fd6295f3554 Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Sun, 5 Nov 2023 11:40:49 +1100 Subject: [PATCH] feat(#679): update menu when logged in on static --- .changeset/flat-birds-play.md | 5 +++++ packages/menu/src/components/DruxtMenu.vue | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 .changeset/flat-birds-play.md diff --git a/.changeset/flat-birds-play.md b/.changeset/flat-birds-play.md new file mode 100644 index 000000000..e8d228156 --- /dev/null +++ b/.changeset/flat-birds-play.md @@ -0,0 +1,5 @@ +--- +"druxt-menu": patch +--- + +feat(#679): update menu items when logged in on static generated site diff --git a/packages/menu/src/components/DruxtMenu.vue b/packages/menu/src/components/DruxtMenu.vue index b17c764aa..4f63a2c7c 100644 --- a/packages/menu/src/components/DruxtMenu.vue +++ b/packages/menu/src/components/DruxtMenu.vue @@ -219,6 +219,15 @@ export default { }, }, + mounted() { + // If logged in and statically generated, re-fetch the menu. + if ((this.$auth || {}).loggedIn && this.$store.app.context.isStatic) { + this.value = undefined + const settings = this.$options.druxt.settings(this, this.component.settings) + this.$options.druxt.fetchData.call(this, settings) + } + }, + methods: { /** * Recursively gets required menu items from the Vuex store.