fix: properly update state when duplicating a list

This commit is contained in:
kolaente 2022-07-19 17:15:39 +02:00
parent a0d0c2cb1f
commit e7de930129
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -36,25 +36,26 @@ import { success } from '@/message'
import {useTitle} from '@/composables/useTitle'
import {useNameSpaceSearch} from '@/composables/useNamespaceSearch'
const {t} = useI18n({useScope: 'global'})
useTitle(() => t('list.duplicate.title'))
const {
namespaces,
findNamespaces,
} = useNameSpaceSearch()
const selectedNamespace = ref<NamespaceModel>()
function selectNamespace(namespace: NamespaceModel) {
selectedNamespace.value = namespace
}
const route = useRoute()
const router = useRouter()
const store = useStore()
const listDuplicateService = shallowReactive(new ListDuplicateService())
async function duplicateList() {
const listDuplicate = new ListDuplicateModel({
// FIXME: should be parameter
@ -64,7 +65,6 @@ async function duplicateList() {
const duplicate = await listDuplicateService.create(listDuplicate)
const store = useStore()
store.commit('namespaces/addListToNamespace', duplicate.list)
store.commit('lists/setList', duplicate.list)
success({message: t('list.duplicate.success')})