Pinafore-Web-Client-Frontend/routes/_components/Timeline.html

48 lines
1.0 KiB
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;
}
2018-01-15 06:41:19 +01:00
li {
border-bottom: 1px solid var(--main-border);
}
2018-01-11 09:26:35 +01:00
</style>
2018-01-09 03:14:21 +01:00
<script>
import { store } from '../_utils/store'
2018-01-13 23:19:51 +01:00
import { getHomeTimeline } from '../_utils/mastodon/oauth'
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-15 04:28:50 +01:00
if (!process.browser) {
return
2018-01-09 03:14:21 +01:00
}
2018-01-15 04:28:50 +01:00
let instanceData = this.store.get('currentInstance')
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>