Compare commits

...

5 Commits

+25 -6
View File
@@ -74,7 +74,7 @@
</div> </div>
</div> </div>
<div <div
v-if="projectIsAccesible && !projectIsAccesible" v-if="projectIsAccesible === false"
class="px-2 py-4 bg-foundation dark:bg-neutral-700/10 rounded-md shadow" class="px-2 py-4 bg-foundation dark:bg-neutral-700/10 rounded-md shadow"
> >
<CommonAlert <CommonAlert
@@ -145,10 +145,25 @@ const projectNavigatorTippy = computed(() =>
const clientId = projectAccount.value.accountInfo.id const clientId = projectAccount.value.accountInfo.id
const { result: projectDetailsResult, refetch: refetchProjectDetails } = useQuery( const accountExists = accountStore.isAccountExistsById(props.project.accountId)
if (!accountExists) {
projectIsAccesible.value = false
}
const {
result: projectDetailsResult,
refetch: refetchProjectDetails,
onError: onProjectDetailsError
} = useQuery(
projectDetailsQuery, projectDetailsQuery,
() => ({ projectId: props.project.projectId }), () => ({ projectId: props.project.projectId }),
() => ({ clientId, debounce: 500, fetchPolicy: 'network-only' }) () => ({
clientId,
debounce: 500,
fetchPolicy: 'network-only',
enabled: accountExists
})
) )
const removeProjectModels = async () => { const removeProjectModels = async () => {
@@ -162,6 +177,10 @@ watch(projectDetails, (newValue) => {
projectIsAccesible.value = newValue !== undefined projectIsAccesible.value = newValue !== undefined
}) })
onProjectDetailsError(() => {
projectIsAccesible.value = false
})
const canLoad = computed(() => !!projectDetails.value?.permissions.canLoad.authorized) const canLoad = computed(() => !!projectDetails.value?.permissions.canLoad.authorized)
const canPublish = computed( const canPublish = computed(
() => !!projectDetails.value?.permissions.canPublish.authorized () => !!projectDetails.value?.permissions.canPublish.authorized
@@ -194,13 +213,13 @@ const isWorkspaceReadOnly = computed(() => {
const { onResult: userProjectsUpdated } = useSubscription( const { onResult: userProjectsUpdated } = useSubscription(
userProjectsUpdatedSubscription, userProjectsUpdatedSubscription,
() => ({}), () => ({}),
() => ({ clientId }) () => ({ clientId, enabled: accountExists })
) )
const { onResult: projectUpdated } = useSubscription( const { onResult: projectUpdated } = useSubscription(
projectUpdatedSubscription, projectUpdatedSubscription,
() => ({ projectId: props.project.projectId }), () => ({ projectId: props.project.projectId }),
() => ({ clientId }) () => ({ clientId, enabled: accountExists })
) )
// to catch changes on visibility of project // to catch changes on visibility of project
@@ -236,7 +255,7 @@ const workspaceUrl = computed(() => {
const { onResult } = useSubscription( const { onResult } = useSubscription(
versionCreatedSubscription, versionCreatedSubscription,
() => ({ projectId: props.project.projectId }), () => ({ projectId: props.project.projectId }),
() => ({ clientId }) () => ({ clientId, enabled: accountExists })
) )
onResult((res) => { onResult((res) => {