Use api.js funcs over manual fetch.

This commit is contained in:
2020-10-11 18:14:43 +02:00
committed by KevinMidboe
parent 0e74534cde
commit f2989d2534
2 changed files with 4 additions and 5 deletions

View File

@@ -11,6 +11,7 @@
<script>
import { page, event } from "vue-analytics";
import { prelottery } from "@/api";
import Banner from "@/ui/Banner";
import Wine from "@/ui/Wine";
@@ -25,8 +26,7 @@ export default {
};
},
async mounted() {
const _wines = await fetch("/api/wines/prelottery");
this.wines = await _wines.json();
prelottery().then(wines => this.wines = wines);
}
};
</script>

View File

@@ -29,7 +29,7 @@
</template>
<script>
import { getAmIWinner, postWineChosen } from "@/api";
import { getAmIWinner, postWineChosen, prelottery } from "@/api";
import Wine from "@/ui/Wine";
export default {
components: { Wine },
@@ -60,8 +60,7 @@ export default {
}
this.turn = true;
this.name = winnerObject.name;
const _wines = await fetch("/api/wines/prelottery");
this.wines = await _wines.json();
this.wines = await prelottery();
},
methods: {
chosenWine: async function(name) {