Skip to content

Commit

Permalink
fix: Issue where all instances were disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
cadriel committed Nov 17, 2020
1 parent 8c11d94 commit 9da4a3d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/store/config/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ export const mutations: MutationTree<ConfigState> = {
}
} else {
instances.forEach((instance, index) => {
instance.active = (index === i)
if (index === i) {
instance.active = (index === i)
instance.name = state.fileConfig.general.instanceName
}
})
Expand All @@ -102,15 +102,15 @@ export const mutations: MutationTree<ConfigState> = {
localStorage.setItem(Globals.LOCAL_INSTANCES_STORAGE_KEY, JSON.stringify(state.instances))
},

addInstance (state, payload) {
const instances = state.instances
const i = instances.findIndex((instance: InstanceConfig) => instance.apiUrl === payload.apiUrl)
if (i === -1) {
instances.push(payload)
Vue.set(state, 'instances', instances)
localStorage.setItem(Globals.LOCAL_INSTANCES_STORAGE_KEY, JSON.stringify(instances))
}
},
// addInstance (state, payload) {
// const instances = state.instances
// const i = instances.findIndex((instance: InstanceConfig) => instance.apiUrl === payload.apiUrl)
// if (i === -1) {
// instances.push(payload)
// Vue.set(state, 'instances', instances)
// localStorage.setItem(Globals.LOCAL_INSTANCES_STORAGE_KEY, JSON.stringify(instances))
// }
// },

removeInstance (state, payload) {
const instances = state.instances
Expand Down

0 comments on commit 9da4a3d

Please sign in to comment.