pinafore/routes/_components/Timeline.html

44 lines
998 B
HTML
Raw Normal View History

2018-01-09 02:14:21 +00:00
<ul>
{{#each statuses as status}}
2018-01-11 08:26:35 +00:00
<li>
<Status :status />
</li>
2018-01-09 02:14:21 +00:00
{{/each}}
</ul>
2018-01-11 08:26:35 +00:00
<style>
ul {
list-style: none;
padding-right: 10px;
}
</style>
2018-01-09 02:14:21 +00:00
<script>
import { store } from '../_utils/store'
import { getHomeTimeline } from '../_utils/mastodon'
2018-01-11 04:45:02 +00:00
import fixture from '../_utils/fixture.json'
import Status from './Status.html'
2018-01-09 02:14:21 +00:00
export default {
2018-01-11 04:45:02 +00:00
oncreate: async function () {
2018-01-09 02:14:21 +00:00
if (process.browser) {
2018-01-13 06:24:54 +00:00
let instanceData = this.store.get('currentInstance')
2018-01-11 04:45:02 +00:00
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 02:14:21 +00:00
}
},
data: () => ({
target: 'home',
statuses: []
}),
2018-01-11 04:45:02 +00:00
store: () => store,
components: {
Status
}
2018-01-09 02:14:21 +00:00
}
</script>