Add create list cmd
This commit is contained in:
parent
a619a89db8
commit
455ccad3c4
|
@ -55,6 +55,7 @@ import NamespaceModel from '@/models/namespace'
|
||||||
import TeamModel from '@/models/team'
|
import TeamModel from '@/models/team'
|
||||||
|
|
||||||
import {CURRENT_LIST} from '@/store/mutation-types'
|
import {CURRENT_LIST} from '@/store/mutation-types'
|
||||||
|
import ListModel from '@/models/list'
|
||||||
|
|
||||||
const TYPE_LIST = 'list'
|
const TYPE_LIST = 'list'
|
||||||
const TYPE_TASK = 'task'
|
const TYPE_TASK = 'task'
|
||||||
|
@ -259,6 +260,22 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
newList() {
|
newList() {
|
||||||
|
if (this.currentList === null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const newList = new ListModel({
|
||||||
|
title: this.query,
|
||||||
|
namespaceId: this.currentList.namespaceId,
|
||||||
|
})
|
||||||
|
this.listService.create(newList)
|
||||||
|
.then(r => {
|
||||||
|
this.success({message: 'The list was successfully created.'}, this)
|
||||||
|
this.$router.push({name: 'list.index', params: {listId: r.id}})
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.error(e, this)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
newNamespace() {
|
newNamespace() {
|
||||||
const newNamespace = new NamespaceModel({title: this.query})
|
const newNamespace = new NamespaceModel({title: this.query})
|
||||||
|
|
Reference in New Issue