decoupling-drupal-vuejs/src/App.vue

39 lines
869 B
Vue
Raw Normal View History

2019-05-24 23:11:42 +00:00
<template>
2019-05-25 00:04:57 +00:00
<div id="app" class="antialiased min-h-screen font-sans bg-gray-100 text-black p-12">
<div class="max-w-5xl mx-auto">
<h1 class="text-4xl font-semibold mb-2">Sessions</h1>
<div v-if="sessions" class="bg-white p-6 rounded-lg border">
<ul class="-mb-3">
<li v-for="session in sessions" :key="session.attributes.drupal_internal__nid" class="mb-3">
{{ session.attributes.title }}
</li>
</ul>
</div>
2019-05-24 23:11:42 +00:00
</div>
</div>
</template>
2019-05-24 23:24:36 +00:00
<style src="./css/app.css"></style>
2019-05-24 23:45:57 +00:00
<script>
const axios = require('axios')
2019-05-25 00:04:57 +00:00
module.exports = {
data () {
return {
sessions: []
}
},
created () {
const baseUrl = 'http://drupaltestcamp.docksal'
axios.get(`${baseUrl}/jsonapi/node/session`)
.then(({ data }) => {
this.sessions = data.data
})
}
}
2019-05-24 23:45:57 +00:00
</script>