Browse Source

fix(gui-v2): remove unnecessary watchEffect

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3123/head
Pranav C 2 years ago
parent
commit
5dbbe8bffa
  1. 9
      packages/nc-gui-v2/composables/useProject.ts
  2. 2
      packages/nc-gui-v2/middleware/auth.global.ts

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

@ -41,15 +41,10 @@ export function useProject(projectId?: MaybeRef<string>) {
_projectId = route.params.projectId as string _projectId = route.params.projectId as string
} }
project.value = await $api.project.read(_projectId!) project.value = await $api.project.read(_projectId!)
await loadProjectRoles()
await loadTables()
} }
watchEffect(async () => {
if (project?.value) {
await loadProjectRoles()
await loadTables()
}
})
const projectBaseType = $computed(() => project.value?.bases?.[0]?.type || '') const projectBaseType = $computed(() => project.value?.bases?.[0]?.type || '')
const isMysql = computed(() => ['mysql', 'mysql2'].includes(projectBaseType)) const isMysql = computed(() => ['mysql', 'mysql2'].includes(projectBaseType))

2
packages/nc-gui-v2/middleware/auth.global.ts

@ -23,7 +23,7 @@ import { useGlobal } from '#imports'
export default defineNuxtRouteMiddleware((to, from) => { export default defineNuxtRouteMiddleware((to, from) => {
const state = useGlobal() const state = useGlobal()
/** if shred base allow without validating token */ /** if shred base allow without validating */
if (to.params?.projectType === 'base') return if (to.params?.projectType === 'base') return
/** if auth is required or unspecified (same as required) and user is not signed in, redirect to signin page */ /** if auth is required or unspecified (same as required) and user is not signed in, redirect to signin page */

Loading…
Cancel
Save