Use YAML parser instead of JSON for deck input

This commit is contained in:
Adam Goldsmith 2019-01-03 21:12:16 +01:00
parent d25da968c4
commit c6853200ab
2 changed files with 3 additions and 3 deletions

View File

@ -14,6 +14,7 @@
"dependencies": { "dependencies": {
"express": "^4.16.4", "express": "^4.16.4",
"interactjs": "^1.3.4", "interactjs": "^1.3.4",
"js-yaml": "^3.12.0",
"nedb-promises": "^3.0.2", "nedb-promises": "^3.0.2",
"parcel-bundler": "^1.11.0", "parcel-bundler": "^1.11.0",
"phantom": "^4.0.12", "phantom": "^4.0.12",

View File

@ -52,6 +52,7 @@
</template> </template>
<script> <script>
import yaml from 'js-yaml';
import Deck from './Deck.vue'; import Deck from './Deck.vue';
export default { export default {
@ -90,9 +91,7 @@
jsonUpload(event) { jsonUpload(event) {
let files = event.target.files; let files = event.target.files;
let reader = new FileReader(); let reader = new FileReader();
reader.onload = event => { reader.onload = e => this.deckInfo = yaml.safeLoad(e.target.result);
this.deckInfo = JSON.parse(event.target.result);
};
reader.readAsText(files[0]); reader.readAsText(files[0]);
}, },