show recipe
This commit is contained in:
parent
f58039e3c6
commit
0957d84ca0
@ -129,10 +129,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<buttons>
|
<div class="buttons">
|
||||||
<button type="button is-primary" class="button">Convert</button>
|
<button type="button is-primary" class="button" @click="convert">Convert</button>
|
||||||
<button type="button" class="button">Close</button>
|
<button type="button" class="button">Close</button>
|
||||||
</buttons>
|
</div>
|
||||||
</app-modal>
|
</app-modal>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -140,7 +140,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
recipe: {
|
recipe: {
|
||||||
@ -187,6 +186,10 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
convert() {
|
||||||
|
this.$router.push({name: 'recipe', query: { scale: this.scaleValue, system: this.systemConvertValue, unit: this.unitConvertValue }});
|
||||||
|
},
|
||||||
|
|
||||||
formatMinutes(min) {
|
formatMinutes(min) {
|
||||||
if (min) {
|
if (min) {
|
||||||
const partUnits = [
|
const partUnits = [
|
||||||
|
@ -34,12 +34,15 @@
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
recipeId: state => state.route.params.id,
|
recipeId: state => state.route.params.id,
|
||||||
|
scale: state => state.route.query.scale || null,
|
||||||
|
system: state => state.route.query.system || null,
|
||||||
|
unit: state => state.route.query.unit || null
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.loadResource(
|
this.loadResource(
|
||||||
api.getRecipe(this.recipeId)
|
api.getRecipe(this.recipeId, this.scale, this.system, this.unit)
|
||||||
.then(data => { this.recipe = data; return data; })
|
.then(data => { this.recipe = data; return data; })
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -105,8 +105,14 @@ class Api {
|
|||||||
return this.get("/recipes", params);
|
return this.get("/recipes", params);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRecipe(id) {
|
getRecipe(id, scale = null, system = null, unit = null) {
|
||||||
return this.get("/recipes/" + id);
|
const params = {
|
||||||
|
scale,
|
||||||
|
system,
|
||||||
|
unit
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.get("/recipes/" + id, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
buildRecipeParams(recipe) {
|
buildRecipeParams(recipe) {
|
||||||
|
Loading…
Reference in New Issue
Block a user