traxxx/assets/components/home/home.vue

67 lines
1.4 KiB
Vue
Raw Normal View History

<template>
<div class="content">
<FilterBar
:filter="filter"
@set-filter="setFilter"
/>
<div class="content-inner">
<ul class="scenes nolist">
<li
v-for="release in releases"
:key="release.id"
class="scene"
>
<ReleaseTile :release="release" />
</li>
</ul>
</div>
</div>
</template>
<script>
import FilterBar from './filter.vue';
import ReleaseTile from '../tile/release.vue';
2019-09-10 14:48:04 +00:00
async function fetchReleases() {
this.releases = await this.$store.dispatch('fetchReleases', {
filter: this.filter,
});
}
async function setFilter(filter) {
this.filter = filter;
localStorage.setItem('filter', this.filter);
await this.fetchReleases();
}
async function mounted() {
this.pageTitle = '';
await this.fetchReleases();
}
export default {
components: {
FilterBar,
ReleaseTile,
},
data() {
const storedFilter = localStorage.getItem('filter');
return {
filter: storedFilter ? storedFilter.split(',') : ['gay', 'transsexual'],
releases: [],
networks: [],
pageTitle: null,
};
},
mounted,
methods: {
fetchReleases,
setFilter,
},
};
</script>