Browse Source

fix(gui-v2): share project role state across composable using useState

re #3394

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3396/head
Pranav C 2 years ago
parent
commit
f28f28a986
  1. 3
      packages/nc-gui-v2/composables/useProject.ts

3
packages/nc-gui-v2/composables/useProject.ts

@ -15,7 +15,7 @@ const [setup, use] = useInjectionState((_projectId?: MaybeRef<string>) => {
const projectId = computed(() => (_projectId ? unref(_projectId) : (route.params.projectId as string))) const projectId = computed(() => (_projectId ? unref(_projectId) : (route.params.projectId as string)))
const project = ref<ProjectType>({}) const project = ref<ProjectType>({})
const tables = ref<TableType[]>([]) const tables = ref<TableType[]>([])
const projectRoles = ref<Record<string, boolean>>({}) const projectRoles = useState<Record<string, boolean>>(USER_PROJECT_ROLES, () => ({}))
const projectMetaInfo = ref<ProjectMetaInfo | undefined>() const projectMetaInfo = ref<ProjectMetaInfo | undefined>()
// todo: refactor path param name and variable name // todo: refactor path param name and variable name
@ -49,7 +49,6 @@ const [setup, use] = useInjectionState((_projectId?: MaybeRef<string>) => {
async function loadProjectRoles() { async function loadProjectRoles() {
projectRoles.value = {} projectRoles.value = {}
if (isSharedBase.value) { if (isSharedBase.value) {
const user = await $api.auth.me( const user = await $api.auth.me(
{}, {},

Loading…
Cancel
Save