Use api.js funcs over manual fetch.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user