pinafore/routes/_components/Timeline.html

36 lines
911 B
HTML
Raw Normal View History

2018-01-09 03:14:21 +01:00
<ul>
{{#each statuses as status}}
2018-01-11 05:45:02 +01:00
<Status :status />
2018-01-09 03:14:21 +01:00
{{/each}}
</ul>
<script>
import { store } from '../_utils/store'
import { getHomeTimeline } from '../_utils/mastodon'
2018-01-11 05:45:02 +01:00
import fixture from '../_utils/fixture.json'
import Status from './Status.html'
2018-01-09 03:14:21 +01:00
export default {
2018-01-11 05:45:02 +01:00
oncreate: async function () {
2018-01-09 03:14:21 +01:00
if (process.browser) {
2018-01-11 05:45:02 +01:00
let instanceData = this.store.get('currentOauthInstance')
if (!instanceData) {
return
}
let response = fixture
// let response = await (await getHomeTimeline(instanceData.instanceName, instanceData.access_token)).json()
if (process.env.NODE_ENV !== 'production') {
console.log(response)
}
this.set({'statuses': response})
2018-01-09 03:14:21 +01:00
}
},
data: () => ({
target: 'home',
statuses: []
}),
2018-01-11 05:45:02 +01:00
store: () => store,
components: {
Status
}
2018-01-09 03:14:21 +01:00
}
</script>