Browse Source

fix: navigation mode change not persisted

NGPixel 5 năm trước cách đây
mục cha
commit
c15d1a4967

+ 12 - 3
client/components/admin/admin-navigation.vue

@@ -376,7 +376,7 @@ export default {
       try {
       try {
         const resp = await this.$apollo.mutate({
         const resp = await this.$apollo.mutate({
           mutation: gql`
           mutation: gql`
-            mutation ($tree: [NavigationTreeInput]!) {
+            mutation ($tree: [NavigationTreeInput]!, $mode: NavigationMode!) {
               navigation{
               navigation{
                 updateTree(tree: $tree) {
                 updateTree(tree: $tree) {
                   responseResult {
                   responseResult {
@@ -385,15 +385,24 @@ export default {
                     slug
                     slug
                     message
                     message
                   }
                   }
+                },
+                updateConfig(mode: $mode) {
+                  responseResult {
+                    succeeded
+                    errorCode
+                    slug
+                    message
+                  }
                 }
                 }
               }
               }
             }
             }
           `,
           `,
           variables: {
           variables: {
-            tree: this.trees
+            tree: this.trees,
+            mode: this.config.mode
           }
           }
         })
         })
-        if (_.get(resp, 'data.navigation.updateTree.responseResult.succeeded', false)) {
+        if (_.get(resp, 'data.navigation.updateTree.responseResult.succeeded', false) && _.get(resp, 'data.navigation.updateConfig.responseResult.succeeded', false)) {
           this.$store.commit('showNotification', {
           this.$store.commit('showNotification', {
             message: this.$t('navigation.saveSuccess'),
             message: this.$t('navigation.saveSuccess'),
             style: 'success',
             style: 'success',