This commit is contained in:
parent
a31e069655
commit
f98af40bd6
|
@ -273,7 +273,8 @@
|
|||
})
|
||||
},
|
||||
addTask() {
|
||||
this.taskService.create({listID: this.$route.params.id}, this.newTask)
|
||||
this.newTask.listID = this.$route.params.id
|
||||
this.taskService.create(this.newTask)
|
||||
.then(r => {
|
||||
this.list.addTaskToList(r)
|
||||
this.handleSuccess({message: 'The task was successfully created.'})
|
||||
|
|
|
@ -18,7 +18,6 @@ export default class TaskModel extends AbstractModel {
|
|||
defaults() {
|
||||
return {
|
||||
id: 0,
|
||||
listID: 0,
|
||||
text: '',
|
||||
description: '',
|
||||
done: false,
|
||||
|
@ -37,6 +36,8 @@ export default class TaskModel extends AbstractModel {
|
|||
createdBy: {},
|
||||
created: 0,
|
||||
updated: 0,
|
||||
|
||||
listID: 0, // Meta, only used when creating a new task
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import {reduce, replace} from 'lodash'
|
|||
let config = require('../../public/config.json')
|
||||
|
||||
// TODO: Reject requests if they don't have route set
|
||||
// TODO: create and get should only take the model as param
|
||||
|
||||
export default class AbstractService {
|
||||
|
||||
|
@ -165,15 +164,14 @@ export default class AbstractService {
|
|||
|
||||
/**
|
||||
* Performs a put request to the url specified before
|
||||
* @param pathparams
|
||||
* @param data
|
||||
* @param model
|
||||
* @returns {Promise<any | never>}
|
||||
*/
|
||||
create(pathparams, data) {
|
||||
create(model) {
|
||||
const cancel = this.setLoading()
|
||||
|
||||
// Finally make the request and get our data.
|
||||
return this.http.put(this.getReplacedRoute(this.paths.create, pathparams), data)
|
||||
return this.http.put(this.getReplacedRoute(this.paths.create, model), model)
|
||||
.catch(error => {
|
||||
return this.errorHandler(error)
|
||||
})
|
||||
|
@ -187,8 +185,7 @@ export default class AbstractService {
|
|||
|
||||
/**
|
||||
* Performs a post request to the update url
|
||||
* @param pathparams
|
||||
* @param data
|
||||
* @param model
|
||||
* @returns {Q.Promise<any>}
|
||||
*/
|
||||
update(model) {
|
||||
|
|
Reference in New Issue
Block a user