Skip to content

Commit

Permalink
feat: parse JSON from configuration form
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Aug 3, 2020
1 parent b0f89da commit 3a6e034
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pages/premium/booru.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<form
class="flex flex-col p-4 material-container text-default-text"
action="#"
@submit.prevent="addCustomBooruToState(formBooru)"
@submit.prevent="addCustomBooruToState()"
>
<!-- Domain -->
<label class="text-default-text-muted" for="booruDomain">Domain</label>
Expand Down Expand Up @@ -151,9 +151,21 @@ export default {
...mapActions('booru', ['activeBooruManager']),
addCustomBooruToState(booruObj) {
let parsedConfig = null
try {
parsedConfig = JSON.parse(this.formBooru.config)
} catch (error) {
console.log(error)
parsedConfig = null
}
this.customBoorusManager({
operation: 'add',
value: { ...booruObj }, // Weird fix because it mutates the vuex store from here???
value: {
...this.formBooru,
config: parsedConfig,
},
})
},
Expand Down

0 comments on commit 3a6e034

Please sign in to comment.