diff --git a/client/public/index.html b/client/public/index.html
index 544c44a..9cd4214 100644
--- a/client/public/index.html
+++ b/client/public/index.html
@@ -5,7 +5,7 @@
-
Spellsaurus
+ Auracle
diff --git a/client/src/components/spells/add-spell-card.vue b/client/src/components/spells/add-spell-card.vue
new file mode 100644
index 0000000..175105d
--- /dev/null
+++ b/client/src/components/spells/add-spell-card.vue
@@ -0,0 +1,154 @@
+
+
+
+
+
+ Nouveau sort
+ {{spell.name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/src/components/spells/edit-spell-card.vue b/client/src/components/spells/edit-spell-card.vue
index 082ba5b..4c6f65d 100644
--- a/client/src/components/spells/edit-spell-card.vue
+++ b/client/src/components/spells/edit-spell-card.vue
@@ -164,6 +164,9 @@ export default {
name: this.spell.name,
description: this.spell.description,
is_ritual: !!+this.spell.is_ritual,
+ level: parseInt(this.spell.level),
+ cost: this.spell.cost,
+ charge: parseInt(this.spell.charge),
schools: schoolsData,
variables: variablesData,
ingredients: ingredientsData,
@@ -173,6 +176,9 @@ export default {
.then(v => {
this.$emit('updateSpell', v.data)
})
+ .catch(err => {
+ console.log(err)
+ })
},
}
}
@@ -181,5 +187,6 @@ export default {
\ No newline at end of file
diff --git a/client/src/components/spells/spells-list.vue b/client/src/components/spells/spells-list.vue
index 6117012..e3f4e6f 100644
--- a/client/src/components/spells/spells-list.vue
+++ b/client/src/components/spells/spells-list.vue
@@ -1,9 +1,11 @@
+
-
+
+
@@ -11,6 +13,7 @@
// Components
import SpellCard from "./spell-card"
import EditSpellCard from "./edit-spell-card"
+import AddSpellCard from "./add-spell-card"
// API
import { RepositoryFactory } from "../../../api/repositories"
@@ -21,12 +24,14 @@ export default {
components: {
'spell-card': SpellCard,
'edit-spell-card': EditSpellCard,
+ 'add-spell-card': AddSpellCard,
},
data() {
return {
loading: false,
spells: [],
- active_spell: {},
+ current_edit_spell: {},
+ adding_spell: false,
}
},
created() {
@@ -44,16 +49,35 @@ export default {
this.spells = displaySpells
},
editSpell(e) {
- this.active_spell = e;
+ this.current_edit_spell = e;
+ },
+ showAdd() {
+ this.adding_spell = true
+ },
+ cancelAdd() {
+ this.adding_spell = false
+ },
+ addSpell(e) {
+ console.log(e)
+ Spells.getSpell(e.id)
+ .then(v => {
+ this.spells.push(v.data)
+ })
+ .then(() => {
+ this.adding_spell = false
+ })
+ .catch(err => {
+ console.log(err)
+ })
},
updateSpell(e) {
let oldSpell = this.spells.find(x => x.id === e.id)
this.spells.splice(this.spells.indexOf(oldSpell), 1, e)
- this.active_spell = {}
+ this.current_edit_spell = {}
},
deleteSpell(e) {
this.spells.splice(this.spells.indexOf(e), 1)
- this.active_spell = {}
+ this.current_edit_spell = {}
}
}
}
diff --git a/client/src/pages/spells-page.vue b/client/src/pages/spells-page.vue
index 1eff260..5449924 100644
--- a/client/src/pages/spells-page.vue
+++ b/client/src/pages/spells-page.vue
@@ -29,7 +29,6 @@
-