Prechádzať zdrojové kódy

به روزرسانی هدر بعد از تغییر استور یوزر

hgh 1 rok pred
rodič
commit
1c093e6968

+ 3 - 2
src/components/Template/Header/MainHeader.vue

@@ -220,7 +220,6 @@
 </template>
 
 <script>
-import { User } from 'src/models/User.js'
 import { Basket } from 'src/models/Basket.js'
 import { mapGetters, mapMutations } from 'vuex'
 import { APIGateway } from 'src/api/APIGateway.js'
@@ -229,12 +228,14 @@ export default {
   name: 'templateHeader',
   data () {
     return {
-      user: new User(),
       topMenuItems: [
       ]
     }
   },
   computed: {
+    user () {
+      return this.$store.getters['Auth/user']
+    },
     cartItemCount () {
       return this.basket.items_info.list.length
     },

+ 7 - 7
src/components/Widgets/AlertMe/AlertMe.vue

@@ -48,11 +48,16 @@ export default {
       is_enabled: false,
       loading: false,
       showLoginDialog: false,
-      isUserLogin: false,
       pendingToggleValue: null
     }
   },
   computed: {
+    user () {
+      return this.$store.getters['Auth/user']
+    },
+    isUserLogin() {
+      return this.$store.getters['Auth/isUserLogin']
+    },
     sourceType() {
       return this.localOptions.sourceType
     },
@@ -63,23 +68,18 @@ export default {
   watch: {
     showLoginDialog (oldVal, newVal) {
       if (oldVal === true && newVal === false && !this.isUserLogin) {
-        // یعنی کاربر دیالوگ رو بست (نه لاگین کرد)
+        // یعنی کاربر دیالوگ رو بست (لاگین نکرد)
         this.is_enabled = false
       }
     }
   },
   mounted () {
-    this.loadAuthData()
     if (this.isUserLogin) {
       this.fetchNotificationStatus()
     }
   },
 
   methods: {
-    loadAuthData () { // prevent Hydration node mismatch
-      this.user = this.$store.getters['Auth/user']
-      this.isUserLogin = this.$store.getters['Auth/isUserLogin']
-    },
     fetchNotificationStatus () {
       this.loading = true
       APIGateway.alert.getMyCorrespondingAlert(