web/src/components/MenuBar.vue

43 lines
844 B
Vue

<template>
<ul>
<li v-for="section in sections">
{{ section.title }}
</li>
</ul>
</template>
<script setup>
import { makeServer } from "../mirage/index.js"
const environment = 'development'
makeServer({ environment })
/* let sections = [ */
/* {"title": "Loading..."} */
/* ] */
/* fetch("/api/v1/test").then( */
/* (res) => { */
/* if (res.ok()) { */
/* return res.json() */
/* }else{ */
/* sections = [{"title": "Error"}] */
/* } */
/* } */
/* ).then( */
/* res => sections = res */
/* ) */
</script>
<script>
export default {
data() {
return {
sections: [{"title": "Loading..."}]
}
},
mounted() {
fetch("/api/v1/test").then(res => res.json()).then(res => sections = res)
}
}
</script>