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

@@ -116,7 +116,6 @@ declare module '@vue/runtime-core' {
HttpTests: typeof import('./components/http/Tests.vue')['default']
HttpURLEncodedParams: typeof import('./components/http/URLEncodedParams.vue')['default']
IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default']
IconLucideBrush: typeof import('~icons/lucide/brush')['default']
IconLucideCheckCircle: typeof import('~icons/lucide/check-circle')['default']
IconLucideChevronRight: typeof import('~icons/lucide/chevron-right')['default']
IconLucideGlobe: typeof import('~icons/lucide/globe')['default']
@@ -125,7 +124,6 @@ declare module '@vue/runtime-core' {
IconLucideInfo: typeof import('~icons/lucide/info')['default']
IconLucideLayers: typeof import('~icons/lucide/layers')['default']
IconLucideMinus: typeof import('~icons/lucide/minus')['default']
IconLucideRss: typeof import('~icons/lucide/rss')['default']
IconLucideSearch: typeof import('~icons/lucide/search')['default']
IconLucideUser: typeof import('~icons/lucide/user')['default']
IconLucideUsers: typeof import('~icons/lucide/users')['default']

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

View File

@@ -45,6 +45,7 @@ export default class TeamEnvironmentAdapter {
this.teamEnvironmentCreated$ = null
this.teamEnvironmentDeleted$ = null
this.teamEnvironmentUpdated$ = null
this.teamEnvironmentCreatedSub = null
this.teamEnvironmentDeletedSub = null
this.teamEnvironmentUpdatedSub = null
@@ -56,6 +57,7 @@ export default class TeamEnvironmentAdapter {
this.teamEnvironmentCreated$?.unsubscribe()
this.teamEnvironmentDeleted$?.unsubscribe()
this.teamEnvironmentUpdated$?.unsubscribe()
this.teamEnvironmentCreatedSub?.unsubscribe()
this.teamEnvironmentDeletedSub?.unsubscribe()
this.teamEnvironmentUpdatedSub?.unsubscribe()