mirror of
https://github.com/romancm/gamebrary
synced 2024-11-28 06:00:22 +00:00
Load releases asynchronously
This commit is contained in:
parent
435e209f63
commit
ed16dc6143
1 changed files with 44 additions and 19 deletions
|
@ -1,5 +1,6 @@
|
|||
<template lang="html">
|
||||
<div class="releases">
|
||||
<template v-if="loaded">
|
||||
<github-button href="https://github.com/romancmx/gamebrary/subscription" data-show-count="true" aria-label="Watch romancmx/gamebrary on GitHub">Watch</github-button>
|
||||
<github-button href="https://github.com/romancmx/gamebrary" data-show-count="true" aria-label="Star romancmx/gamebrary on GitHub">Star</github-button>
|
||||
<github-button href="https://github.com/romancmx/gamebrary/fork" data-show-count="true" aria-label="Fork romancmx/gamebrary on GitHub">Fork</github-button>
|
||||
|
@ -23,6 +24,9 @@
|
|||
|
||||
<vue-markdown :source="notification.body" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<releases-placeholder v-else />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -40,14 +44,35 @@ export default {
|
|||
ReleasesPlaceholder,
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
loaded: false,
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['releases']),
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.loaded = Boolean(this.releases);
|
||||
|
||||
if (!this.releases) {
|
||||
this.load();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
formattedDate(date) {
|
||||
return moment(date).fromNow();
|
||||
},
|
||||
|
||||
load() {
|
||||
this.$store.dispatch('LOAD_RELEASES')
|
||||
.then(() => {
|
||||
this.loaded = true;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue