fix(fe): setActiveWorkspaceMutation - check workspace FF and early return if false
fix(fe): setActiveWorkspaceMutation - check workspace FF and early return if false
This commit is contained in:
@@ -14,6 +14,7 @@ export const useNavigation = () => {
|
||||
const state = useNavigationState()
|
||||
const { mutate } = useMutation(setActiveWorkspaceMutation)
|
||||
const { $intercom } = useNuxtApp()
|
||||
const isWorkspacesEnabled = useIsWorkspacesEnabled()
|
||||
|
||||
const activeWorkspaceSlug = computed({
|
||||
get: () => state.value.activeWorkspaceSlug,
|
||||
@@ -28,6 +29,8 @@ export const useNavigation = () => {
|
||||
const mutateActiveWorkspaceSlug = async (newVal: string | null) => {
|
||||
state.value.activeWorkspaceSlug = newVal
|
||||
state.value.isProjectsActive = false
|
||||
if (!isWorkspacesEnabled.value) return
|
||||
|
||||
await mutate({ slug: newVal, isProjectsActive: false })
|
||||
$intercom.updateCompany()
|
||||
}
|
||||
@@ -35,6 +38,8 @@ export const useNavigation = () => {
|
||||
const mutateIsProjectsActive = async (isActive: boolean) => {
|
||||
state.value.isProjectsActive = isActive
|
||||
state.value.activeWorkspaceSlug = null
|
||||
if (!isWorkspacesEnabled.value) return
|
||||
|
||||
await mutate({ isProjectsActive: state.value.isProjectsActive, slug: null })
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,11 @@ export = !FF_WORKSPACES_MODULE_ENABLED
|
||||
Mutation: {
|
||||
workspaceMutations: () => ({})
|
||||
},
|
||||
ActiveUserMutations: {
|
||||
setActiveWorkspace: async () => {
|
||||
throw new WorkspacesModuleDisabledError()
|
||||
}
|
||||
},
|
||||
WorkspaceMutations: {
|
||||
create: async () => {
|
||||
throw new WorkspacesModuleDisabledError()
|
||||
|
||||
Reference in New Issue
Block a user