diff --git a/src/views/kungalgamer/KUNGalgamer.vue b/src/views/kungalgamer/KUNGalgamer.vue index b12dd275..b9f465b5 100644 --- a/src/views/kungalgamer/KUNGalgamer.vue +++ b/src/views/kungalgamer/KUNGalgamer.vue @@ -8,25 +8,25 @@ import { useRoute } from 'vue-router' import { UserInfo } from '@/api' import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer' +import { storeToRefs } from 'pinia' -// Get the current user's UID from the route parameters const uid = computed(() => { return parseInt(useRoute().params.uid as string) }) const user = ref() +const { name, moemoepoint } = storeToRefs(useKUNGalgameUserStore()) -// Fetch current user information const getUser = async (uid: number) => { const userInfo = await useKUNGalgameUserStore().getUser(uid) return userInfo.data } -// Fetch user information when mounted onMounted(async () => { user.value = await getUser(uid.value) - // Update the locally stored latest moemoepoint of the user, as it is not real-time - useKUNGalgameUserStore().moemoepoint = user.value.moemoepoint + if (user.value.name === name.value) { + moemoepoint.value = user.value.moemoepoint + } }) diff --git a/src/views/kungalgamer/components/Header.vue b/src/views/kungalgamer/components/Header.vue index 7421ffd3..8c074fb5 100644 --- a/src/views/kungalgamer/components/Header.vue +++ b/src/views/kungalgamer/components/Header.vue @@ -1,13 +1,6 @@