diff --git a/pages/watchList.vue b/pages/watchList.vue
index 7358cd2..06672c7 100644
--- a/pages/watchList.vue
+++ b/pages/watchList.vue
@@ -32,9 +32,11 @@
right>
Move to
-
+
- {{ action }}
+ {{ action.name }}
@@ -117,10 +119,16 @@
2: '',
3: ''
},
- actionsList: [
- 'Watch list',
- 'Watching',
- 'Seen'
+ actionsList: [{
+ name: 'Watch list',
+ list: 'watchList'
+ }, {
+ name:'Watching',
+ list: 'watching'
+ }, {
+ name: 'Seen',
+ list: 'seen'
+ }
],
allSelected: {
1: false,
@@ -161,7 +169,6 @@
},
addEntry (i) {
if (this.entries[i] !== '') {
- console.log(i - 1)
console.log(`[${(new Date()).toLocaleTimeString()}]: Adding ${this.entries[i]} to list.`)
this.$store.commit('updateList', {
entry: this.entries[i],
@@ -207,6 +214,24 @@
this.allSelected[i] = true
}
+ },
+ moveTo (name, i) {
+ this.selected[i].forEach((anime) => {
+ this.$store.commit('updateList', {
+ listName: name,
+ entry: anime
+ })
+
+ this.$store.commit('removeFromList', {
+ listName: this.actionsList[i - 1].list,
+ entry: anime
+ })
+ })
+
+ // Remove all selected class
+ const elems = document.getElementsByClassName('elem')
+
+ for (let j = 0, l = elems.length; j < l; ++j) { elems[j].children[0].classList.remove('selected') }
}
}
}
diff --git a/store/index.js b/store/index.js
index 80c4105..df911ce 100644
--- a/store/index.js
+++ b/store/index.js
@@ -167,6 +167,12 @@ const store = new Vuex.Store({
log(`${listName} list updated.`)
}
+ },
+ removeFromList (state, data) {
+ const listName = data.listName
+ const index = state.watchLists[listName].indexOf(data.entry)
+
+ state.watchLists[listName].splice(index, 1)
}
},
actions: {