Skip to content

Commit

Permalink
feat(client): update features when route changed
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 committed Apr 9, 2024
1 parent 00b557d commit 2140655
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client/src/functions/useProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Role } from '@/api/modules/role'
import { useAPI } from '@/functions/useAPI'
import { useLocale } from '@/i18n'
import { InjectionKey, ComputedRef, ShallowRef, computed, provide, watch, inject } from 'vue'
import { useRoute } from 'vue-router'


interface ProjectContext {
Expand All @@ -22,6 +23,7 @@ const projectSymbol: InjectionKey<ProjectContext> = Symbol('project')

export function provideProject () {
const { locale } = useLocale()
const route = useRoute()

const { data: user, loading: userLoading, execute: reloadUser } = useAPI(api.project.getMeInfo)

Expand All @@ -37,6 +39,10 @@ export function provideProject () {
}
}, { immediate: true })

watch(route, () => {
reloadFeatures()
})

const loading = computed(() => userLoading.value || projectLoading.value || featuresLoading.value || rolesLoading.value)

const context = {
Expand Down

0 comments on commit 2140655

Please sign in to comment.