pinafore/routes/_components/Timeline.html

44 lines
998 B
HTML
Raw Normal View History

2018-01-09 03:14:21 +01:00
<ul>
{{#each statuses as status}}
2018-01-11 09:26:35 +01:00
<li>
<Status :status />
</li>
2018-01-09 03:14:21 +01:00
{{/each}}
</ul>
2018-01-11 09:26:35 +01:00
<style>
ul {
list-style: none;
padding-right: 10px;
}
</style>
2018-01-09 03:14:21 +01:00
<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-13 07:24:54 +01:00
let instanceData = this.store.get('currentInstance')
2018-01-11 05:45:02 +01: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 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>