Trivialized cookie and renamed a function

This commit is contained in:
Alexis
2020-08-03 22:28:14 +02:00
parent 117d174480
commit ee287d1722
2 changed files with 11 additions and 13 deletions

View File

@@ -45,14 +45,12 @@
}, },
methods: { methods: {
logoutUser() { logoutUser() {
if (this.$cookies.get('U_') != null) {
this.$cookies.remove('U_') this.$cookies.remove('U_')
this.$store.commit('logout') this.$store.commit('logout')
this.$router.push('/') this.$router.push('/')
} }
} }
} }
}
</script> </script>
<style lang="scss"></style> <style lang="scss"></style>

View File

@@ -42,7 +42,7 @@
</button> </button>
<div <div
v-if="computedSpells.length > 0" v-if="filteredSpells.length > 0"
class="spell-list-wrapper"> class="spell-list-wrapper">
<div <div
class="row spells-list" class="row spells-list"
@@ -52,7 +52,7 @@
<spell-card <spell-card
class="spell-card" class="spell-card"
v-masonry-tile v-masonry-tile
v-for="(spell) in computedSpells" v-for="(spell) in filteredSpells"
:key="spell.id" :key="spell.id"
:spell="spell" :spell="spell"
@editSpell="editSpell" @editSpell="editSpell"
@@ -110,7 +110,7 @@ export default {
} }
}, },
computed: { computed: {
computedSpells() { filteredSpells() {
return this.spells return this.spells
}, },
user() { user() {
@@ -118,7 +118,7 @@ export default {
} }
}, },
beforeMount() { beforeMount() {
this.spells = this.computedSpells this.spells = this.filteredSpells
if (!this.school_id) { if (!this.school_id) {
this.getInitialSpells() this.getInitialSpells()
} else { } else {
@@ -135,7 +135,7 @@ export default {
Spells.getPage(this.currentIndex) Spells.getPage(this.currentIndex)
.then(v => { .then(v => {
this.loading = true this.loading = true
let spells = this.computedSpells let spells = this.filteredSpells
spells.push(v.data) spells.push(v.data)
this.spells = spells[0] this.spells = spells[0]
}) })
@@ -151,7 +151,7 @@ export default {
Schools.getSpellsFromOne(this.school_id) Schools.getSpellsFromOne(this.school_id)
.then(v => { .then(v => {
this.loading = true this.loading = true
let spells = this.computedSpells let spells = this.filteredSpells
spells.push(v.data.spells) spells.push(v.data.spells)
this.spells = spells[0] this.spells = spells[0]
}) })
@@ -169,7 +169,7 @@ export default {
Spells.getPage(this.currentIndex) Spells.getPage(this.currentIndex)
.then(v => { .then(v => {
this.loading = true this.loading = true
let spells = this.computedSpells let spells = this.filteredSpells
for (let i = 0; i < v.data.length; i++) { for (let i = 0; i < v.data.length; i++) {
const element = v.data[i]; const element = v.data[i];
spells.push(element) spells.push(element)
@@ -198,7 +198,7 @@ export default {
addSpell(e) { addSpell(e) {
Spells.getOne(e.id) Spells.getOne(e.id)
.then(v => { .then(v => {
let spells = this.computedSpells let spells = this.filteredSpells
spells.unshift(v.data) spells.unshift(v.data)
}) })
.then(() => { .then(() => {