fix: team environment bug when logout (#2970)

This commit is contained in:
Nivedin
2023-04-07 03:00:30 +05:30
committed by GitHub
parent 8caf9f110b
commit b88f496f4e
4 changed files with 17 additions and 24 deletions

View File

@@ -255,15 +255,6 @@ watch(
}
)
watch(
() => environmentType.value.selectedTeam,
(newTeam) => {
if (newTeam) {
adapter.changeTeamID(newTeam.id)
}
}
)
const switchToMyEnvironments = () => {
environmentType.value.selectedTeam = undefined
updateEnvironmentType("my-environments")
@@ -282,17 +273,10 @@ const updateEnvironmentType = (newEnvironmentType: EnvironmentType) => {
}
watch(
() => environmentType.value.selectedTeam?.id,
(newTeamID) => {
adapter.changeTeamID(newTeamID)
}
)
watch(
() => currentUser.value,
(newValue) => {
if (!newValue) {
switchToMyEnvironments()
() => environmentType.value.selectedTeam,
(newTeam) => {
if (newTeam) {
adapter.changeTeamID(newTeam.id)
}
}
)
@@ -320,6 +304,15 @@ watch(
}
)
watch(
() => currentUser.value,
(newValue) => {
if (!newValue) {
switchToMyEnvironments()
}
}
)
const showModalDetails = ref(false)
const action = ref<"new" | "edit">("edit")
const editingEnvironmentIndex = ref<"Global" | null>(null)

View File

@@ -125,14 +125,14 @@ import { useColorMode } from "~/composables/theming"
import IconPlus from "~icons/lucide/plus"
import IconArchive from "~icons/lucide/archive"
import IconHelpCircle from "~icons/lucide/help-circle"
import { Team } from "~/helpers/backend/graphql"
import { defineActionHandler } from "~/helpers/actions"
import { GetMyTeamsQuery } from "~/helpers/backend/graphql"
const t = useI18n()
const colorMode = useColorMode()
type SelectedTeam = Team | undefined
type SelectedTeam = GetMyTeamsQuery["myTeams"][number] | undefined
const props = defineProps<{
team: SelectedTeam