pinafore/routes/_components/Timeline.html
2018-01-08 18:14:21 -08:00

29 lines
733 B
HTML

<ul>
{{#each statuses as status}}
<div>{{JSON.stringify(status, null, ' ')}}</div>
{{/each}}
</ul>
<script>
import { store } from '../_utils/store'
import { getHomeTimeline } from '../_utils/mastodon'
export default {
oncreate: function () {
if (process.browser) {
(async () => {
let instanceData = this.store.get('currentOauthInstance')
if (!instanceData) {
return
}
let response = await (await getHomeTimeline(instanceData.instanceName, instanceData.access_token)).json()
this.set({'statuses': response})
})()
}
},
data: () => ({
target: 'home',
statuses: []
}),
store: () => store
}
</script>