add eslint working conf

This commit is contained in:
2020-04-29 21:05:38 +02:00
parent ffe8c167cb
commit ebb1c58f90
33 changed files with 866 additions and 846 deletions

View File

@@ -14,30 +14,30 @@
</template>
<script>
export default {
name: "ToDo",
data: function () {
return {
name: this.toDo.data.attributes.data.name,
errors: null,
edit: false,
checked: false,
}
},
props: {
toDo: {
type: Object,
require: true
},
position: {
type: Number,
require: true
}
},
mounted() {
console.log(this.$key)
export default {
name: 'ToDo',
data: function () {
return {
name: this.toDo.data.attributes.data.name,
errors: null,
edit: false,
checked: false,
}
},
props: {
toDo: {
type: Object,
require: true
},
position: {
type: Number,
require: true
}
},
mounted() {
console.log(this.$key)
}
}
</script>
<style scoped>

View File

@@ -9,7 +9,7 @@
</div>
<ToDo v-else
v-for="(toDo, indexToDo) in toDoList.data.attributes.data.to_dos.data"
key="indexToDo"
:key="indexToDo"
:toDo="toDo"
:position="indexToDo" />
</ul>
@@ -23,54 +23,56 @@
</template>
<script>
import InputField from "../../components/InputField";
import ToDo from "./ToDo";
import InputField from '../../components/InputField'
import ToDo from './ToDo'
export default {
name: "ToDoList",
components: {
InputField, ToDo
export default {
name: 'ToDoList',
components: {
InputField, ToDo
},
data: function () {
return {
name: '',
errors: null,
list: null,
edit: false,
}
},
props: {
toDoList: {
type: Object,
require: true
}
},
mounted() {
this.list = this.$el.querySelector('.draggable-list')
console.log(this.list)
},
methods: {
addToDo: function () {
// eslint-disable-next-line no-undef
axios.post('/api/to-do-lists/' + this.toDoList.data.to_do_list_id + '/to-do', {name: this.name})
.then(res => {
this.toDoList.data.attributes.data.to_dos.data.push(res.data)
this.name = ''
})
.catch(errorRes => {
console.log('Internal Error, Unable to delete contact.' + errorRes)
})
},
data: function () {
return {
name: '',
errors: null,
list: null,
edit: false,
}
},
props: {
toDoList: {
type: Object,
require: true
}
},
mounted() {
this.list = this.$el.querySelector('.draggable-list')
console.log(this.list)
},
methods: {
addToDo: function () {
axios.post('/api/to-do-lists/' + this.toDoList.data.to_do_list_id + '/to-do', {name: this.name})
.then(res => {
this.toDoList.data.attributes.data.to_dos.data.push(res.data)
this.name = ''
})
.catch(errorRes => {
console.log('Internal Error, Unable to delete contact.' + errorRes)
})
},
deleteToDo: function (toDo, position) {
axios.delete('/api/to-do-lists/' + this.toDoList.data.to_do_list_id + '/to-do/' + toDo.data.to_do_id)
.then(res => {
this.toDoList.data.attributes.data.to_dos.data.splice(position, 1)
})
.catch(errorRes => {
console.log('Internal Error, Unable to delete contact.' + errorRes)
})
}
deleteToDo: function (toDo, position) {
// eslint-disable-next-line no-undef
axios.delete('/api/to-do-lists/' + this.toDoList.data.to_do_list_id + '/to-do/' + toDo.data.to_do_id)
.then(() => {
this.toDoList.data.attributes.data.to_dos.data.splice(position, 1)
})
.catch(errorRes => {
console.log('Internal Error, Unable to delete contact.' + errorRes)
})
}
}
}
</script>

View File

@@ -10,7 +10,7 @@
</div>
</div>
<div class="flex-between flex-center mb-1">
<a href="#" class="btn" @click="$router.back()">< Back</a>
<a href="#" class="btn" @click="$router.back()">Back</a>
<a href="#" class="btn-primary" @click="modal = ! modal">Add New List</a>
</div>
@@ -27,50 +27,52 @@
</template>
<script>
import Loader from "../../components/Loader";
import InputField from "../../components/InputField";
import ToDoList from "./ToDoList";
import Loader from '../../components/Loader'
import InputField from '../../components/InputField'
import ToDoList from './ToDoList'
export default {
name: "ToDoListIndex",
components: {
Loader, InputField, ToDoList
},
data: function () {
return {
loading: true,
modal: false,
toDoLists: null,
name: '',
errors: null,
}
},
mounted() {
axios.get('/api/to-do-lists')
export default {
name: 'ToDoListIndex',
components: {
Loader, InputField, ToDoList
},
data: function () {
return {
loading: true,
modal: false,
toDoLists: null,
name: '',
errors: null,
}
},
mounted() {
// eslint-disable-next-line no-undef
axios.get('/api/to-do-lists')
.then(res => {
this.toDoLists = res.data.data
this.loading = false
})
.catch(errorRes => {
this.loading = false
if (errorRes.response.status === 404) {
this.$router.push('/')
}
})
},
methods: {
create: function () {
// eslint-disable-next-line no-undef
axios.post('/api/to-do-lists', {name: this.name})
.then(res => {
this.toDoLists = res.data.data
this.loading = false
console.log(res)
this.modal = false
this.name = ''
this.toDoLists.push(res.data)
})
.catch(errorRes => {
this.loading = false
if (errorRes.response.status === 404) {
this.$router.push('/')
}
console.log('Internal Error, Unable to delete contact.' + errorRes)
})
},
methods: {
create: function () {
axios.post('/api/to-do-lists', {name: this.name})
.then(res => {
console.log(res)
this.modal = false
this.name = ''
this.toDoLists.push(res.data)
})
.catch(errorRes => {
console.log('Internal Error, Unable to delete contact.' + errorRes)
})
}
}
}
}
</script>

View File

@@ -1,9 +1,9 @@
<template>
<div></div>
</template>
<script>
export default {
name: "ToDoListShow"
}
export default {
name: 'ToDoListShow'
}
</script>