Move everything to models and services #17
|
@ -11,8 +11,7 @@
|
|||
"bulma": "^0.7.1",
|
||||
"lodash": "^4.17.11",
|
||||
"v-tooltip": "^2.0.0-rc.33",
|
||||
"vue": "^2.5.17",
|
||||
"vue-mc": "^0.5.0"
|
||||
"vue": "^2.5.17"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.4",
|
||||
|
|
|
@ -256,17 +256,13 @@
|
|||
//const cancel = message.setLoading(this)
|
||||
|
||||
let listService = new ListService()
|
||||
|
||||
let list = listService.get({id: this.listID}, {}).then(r => {
|
||||
this.$set(this, 'list', r)
|
||||
})
|
||||
// eslint-disable-next-line
|
||||
console.log(list)
|
||||
// eslint-disable-next-line
|
||||
console.log(list.getTitle())
|
||||
|
||||
/*this.list = new List({id: this.listID})
|
||||
this.list.fetch()*/
|
||||
listService.get({id: this.$route.params.id}, {})
|
||||
.then(r => {
|
||||
this.$set(this, 'list', r)
|
||||
})
|
||||
.catch(e => {
|
||||
this.handleError(e)
|
||||
})
|
||||
|
||||
/*
|
||||
|
||||
|
|
|
@ -1,6 +1,20 @@
|
|||
import abstractModel from "./abstractModel";
|
||||
|
||||
export default class ListModel extends abstractModel {
|
||||
|
||||
constructor(data) {
|
||||
super(data)
|
||||
|
||||
// Set the tasks to [] if its empty so we can add tasks
|
||||
// FIXME: need a better solution for this (aka properly setting defaults
|
||||
if(this.tasks === null) {
|
||||
this.tasks = []
|
||||
}
|
||||
this.sortTasks()
|
||||
// eslint-disable-next-line
|
||||
console.log(this)
|
||||
}
|
||||
|
||||
// Default attributes that define the "empty" state.
|
||||
defaults() {
|
||||
return {
|
||||
|
@ -19,4 +33,17 @@ export default class ListModel extends abstractModel {
|
|||
getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
sortTasks() {
|
||||
if (this.tasks === null || this.tasks === []) {
|
||||
return
|
||||
}
|
||||
return this.tasks.sort(function(a,b) {
|
||||
if (a.done < b.done)
|
||||
return -1
|
||||
if (a.done > b.done)
|
||||
return 1
|
||||
return 0
|
||||
})
|
||||
}
|
||||
}
|
|
@ -88,7 +88,7 @@ export default class AbstractService {
|
|||
|
||||
|
||||
// eslint-disable-next-line
|
||||
console.log('[Req][GET][%s] %o', this.paths.get, params, replaced);
|
||||
console.log('[Req][GET][%s] %o', this.paths.get, params, pathparams, replaced);
|
||||
return this.http.get(replaced, {params: params})
|
||||
.catch(error => {
|
||||
return this.errorHandler(this.paths.get, error);
|
||||
|
|
26
yarn.lock
26
yarn.lock
|
@ -2672,11 +2672,6 @@ dashdash@^1.12.0:
|
|||
dependencies:
|
||||
assert-plus "^1.0.0"
|
||||
|
||||
date-fns@^2.0.0-alpha.25:
|
||||
version "2.0.0-alpha.27"
|
||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-alpha.27.tgz#5ecd4204ef0e7064264039570f6e8afbc014481c"
|
||||
integrity sha512-cqfVLS+346P/Mpj2RpDrBv0P4p2zZhWWvfY5fuWrXNR/K38HaAGEkeOwb47hIpQP9Jr/TIxjZ2/sNMQwdXuGMg==
|
||||
|
||||
date-now@^0.1.4:
|
||||
version "0.1.4"
|
||||
resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"
|
||||
|
@ -8940,11 +8935,6 @@ validate-npm-package-name@^3.0.0, validate-npm-package-name@~3.0.0:
|
|||
dependencies:
|
||||
builtins "^1.0.3"
|
||||
|
||||
validator@^10.9.0:
|
||||
version "10.11.0"
|
||||
resolved "https://registry.yarnpkg.com/validator/-/validator-10.11.0.tgz#003108ea6e9a9874d31ccc9e5006856ccd76b228"
|
||||
integrity sha512-X/p3UZerAIsbBfN/IwahhYaBbY68EN/UQBWHtsbXGT5bfrH/p4NQzUCG1kF/rtKaNpnJ7jAu6NGTdSNtyNIXMw==
|
||||
|
||||
vary@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
|
||||
|
@ -9006,17 +8996,6 @@ vue-loader@^15.4.2:
|
|||
vue-hot-reload-api "^2.3.0"
|
||||
vue-style-loader "^4.1.0"
|
||||
|
||||
vue-mc@^0.5.0:
|
||||
version "0.5.0"
|
||||
resolved "https://registry.yarnpkg.com/vue-mc/-/vue-mc-0.5.0.tgz#9202a191ca2472b951265f1e326dd8772388c672"
|
||||
integrity sha512-04czw1f5jLBHxV/S3tlNjP1NwJ7iXWztnH2y9veWERl3eml5gh67W/KypTRvem/lUJJZPK6THJ8j5oiCMdDL0A==
|
||||
dependencies:
|
||||
axios "^0.18.0"
|
||||
date-fns "^2.0.0-alpha.25"
|
||||
lodash "^4.17.11"
|
||||
validator "^10.9.0"
|
||||
vue "2.5.17"
|
||||
|
||||
vue-multiselect@^2.1.0:
|
||||
version "2.1.3"
|
||||
resolved "https://registry.yarnpkg.com/vue-multiselect/-/vue-multiselect-2.1.3.tgz#5454731086d8c431b527051a56910a8babe090af"
|
||||
|
@ -9058,11 +9037,6 @@ vue-template-es2015-compiler@^1.6.0:
|
|||
resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.6.0.tgz#dc42697133302ce3017524356a6c61b7b69b4a18"
|
||||
integrity sha512-x3LV3wdmmERhVCYy3quqA57NJW7F3i6faas++pJQWtknWT+n7k30F4TVdHvCLn48peTJFRvCpxs3UuFPqgeELg==
|
||||
|
||||
vue@2.5.17:
|
||||
version "2.5.17"
|
||||
resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.17.tgz#0f8789ad718be68ca1872629832ed533589c6ada"
|
||||
integrity sha512-mFbcWoDIJi0w0Za4emyLiW72Jae0yjANHbCVquMKijcavBGypqlF7zHRgMa5k4sesdv7hv2rB4JPdZfR+TPfhQ==
|
||||
|
||||
vue@^2.5.17:
|
||||
version "2.5.21"
|
||||
resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.21.tgz#3d33dcd03bb813912ce894a8303ab553699c4a85"
|
||||
|
|
Reference in New Issue
Block a user