Use api.js funcs over manual fetch.
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { page, event } from "vue-analytics";
|
import { page, event } from "vue-analytics";
|
||||||
|
import { prelottery } from "@/api";
|
||||||
import Banner from "@/ui/Banner";
|
import Banner from "@/ui/Banner";
|
||||||
import Wine from "@/ui/Wine";
|
import Wine from "@/ui/Wine";
|
||||||
|
|
||||||
@@ -25,8 +26,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
const _wines = await fetch("/api/wines/prelottery");
|
prelottery().then(wines => this.wines = wines);
|
||||||
this.wines = await _wines.json();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getAmIWinner, postWineChosen } from "@/api";
|
import { getAmIWinner, postWineChosen, prelottery } from "@/api";
|
||||||
import Wine from "@/ui/Wine";
|
import Wine from "@/ui/Wine";
|
||||||
export default {
|
export default {
|
||||||
components: { Wine },
|
components: { Wine },
|
||||||
@@ -60,8 +60,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.turn = true;
|
this.turn = true;
|
||||||
this.name = winnerObject.name;
|
this.name = winnerObject.name;
|
||||||
const _wines = await fetch("/api/wines/prelottery");
|
this.wines = await prelottery();
|
||||||
this.wines = await _wines.json();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
chosenWine: async function(name) {
|
chosenWine: async function(name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user