feat: deleting integration your are currently on, should move you to global
This commit is contained in:
parent
69a08e6c8c
commit
7b0f1cbf2e
|
|
@ -139,14 +139,17 @@ export const useLaunchStore = create<StoreState>()((set) => ({
|
||||||
settings: any
|
settings: any
|
||||||
) => {
|
) => {
|
||||||
set((state) => {
|
set((state) => {
|
||||||
const existingIndex = state.selectedIntegrations.findIndex(
|
const existing = state.selectedIntegrations.find(
|
||||||
(i) => i.integration.id === integration.id
|
(i) => i.integration.id === integration.id
|
||||||
);
|
);
|
||||||
|
|
||||||
if (existingIndex > -1) {
|
if (existing) {
|
||||||
return {
|
return {
|
||||||
|
...(existing.integration.id === state.current
|
||||||
|
? { current: 'global' }
|
||||||
|
: {}),
|
||||||
selectedIntegrations: state.selectedIntegrations.filter(
|
selectedIntegrations: state.selectedIntegrations.filter(
|
||||||
(_, index) => index !== existingIndex
|
(s, index) => s.integration.id !== existing.integration.id
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue