2020-02-04 18:36:22 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<p v-if="$fetchState.pending">
|
|
|
|
Fetching...
|
|
|
|
</p>
|
|
|
|
<p v-else-if="$fetchState.error">
|
|
|
|
{{ $fetchState.error }}
|
|
|
|
</p>
|
|
|
|
<pre v-else>{{ team }}</pre>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2020-12-17 11:49:59 +00:00
|
|
|
fetchKey: 'team',
|
2020-02-04 18:36:22 +00:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
team: []
|
|
|
|
}
|
2020-11-14 17:10:53 +00:00
|
|
|
},
|
|
|
|
async fetch () {
|
|
|
|
const url = (process.server ? `http://${this.$ssrContext.req.headers.host}` : '')
|
|
|
|
|
|
|
|
this.team = await fetch(`${url}/team.json`).then(res => res.json())
|
2020-02-04 18:36:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|