working on rust side
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<button @click="fetchSolution"
|
||||
<button @click="fetchCompletion"
|
||||
class="button is-primary is-fullwidth"
|
||||
v-bind:class="{'is-loading': is_loading }">
|
||||
FetchSolution</button>
|
||||
@@ -109,7 +109,23 @@ export default {
|
||||
return res.json();}
|
||||
)
|
||||
.then((data) => this.template.updateJson(data))
|
||||
.catch((err) => console.log(err));
|
||||
.catch((err) => console.error(err));
|
||||
},
|
||||
fetchCompletion: function() {
|
||||
this.is_loading = true;
|
||||
// TODO: Keep only value's id
|
||||
let body = JSON.stringify(this.template.items);
|
||||
fetch("http://localhost:8000/api/solver/complete", {
|
||||
method: 'POST',
|
||||
body,
|
||||
})
|
||||
.then((res) => {
|
||||
this.is_loading = false;
|
||||
return res.json();}
|
||||
)
|
||||
.then((data) => this.template.updateJson(data))
|
||||
.catch((err) => console.error(err));
|
||||
|
||||
},
|
||||
unsetMeal: function(mealKey) {
|
||||
let idx = this.template.findIndexByKey(mealKey);
|
||||
|
||||
Reference in New Issue
Block a user