Skip to content

Commit

Permalink
fix mcf loading
Browse files Browse the repository at this point in the history
  • Loading branch information
pvgenuchten committed Nov 11, 2024
1 parent 284e141 commit 33ebe7b
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/components/MainMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,14 @@ var parseString = require("xml2js").parseString;
export default {
emits: ["updateModel"],
name: "IntroPage",
setup() {
async mounted() {
let self = this
const searchParams = new URLSearchParams(document.location.search);
if (searchParams.has('mcf') && searchParams.get('mcf').startsWith('http')){
try {
fetch(decodeURI(searchParams.get('mcf'))).then(
function (response) {
if (response.data) {
var model = this.loadMCF(parse(self.loadMCF(response.data.value)));
self.$emit("updateModel", model);
}
}
)
fetch(decodeURI(searchParams.get('mcf')))
.then(r => r.text())
.then(body => self.$emit("updateModel", this.loadMCF(parse(body))))
} catch (error) {
console.error(error);
}
Expand Down Expand Up @@ -281,7 +276,6 @@ export default {
model.distribution = { distributions: dict2array(model["distribution"],"type") };
//todo: verify if this is valid mcf, you could merge the json with a default json
//if (this.data.mcf && this.data.mcf.version && this.data.mcf.version == "1.0"){}
console.log(model);
return model;
},
fetchDOI() {
Expand Down

0 comments on commit 33ebe7b

Please sign in to comment.