mirror of https://github.com/Kylart/KawAnime.git
Implemented auto-refresh on releases (every 30 minutes)
Better handling of clicks on more buttons in releases page
This commit is contained in:
parent
eafa4afe7e
commit
5975e1677c
|
@ -19,7 +19,13 @@ module.exports = {
|
|||
'assets/main.css'
|
||||
],
|
||||
head: {
|
||||
title: 'KawAnime',
|
||||
meta: [
|
||||
{charset: 'utf-8'},
|
||||
{name: 'viewport', content: 'width=device-width, initial-scale=1'},
|
||||
],
|
||||
link: [
|
||||
// { rel: 'icon', type: 'image/x-icon', href: 'favicon.ico' },
|
||||
{rel: 'stylesheet', href: 'http://fonts.googleapis.com/css?family=Roboto'},
|
||||
{rel: 'stylesheet', href: 'http://fonts.googleapis.com/icon?family=Material+Icons'}
|
||||
]
|
||||
|
|
|
@ -74,15 +74,15 @@
|
|||
</v-btn>
|
||||
<v-list>
|
||||
<v-list-item>
|
||||
<v-list-tile>
|
||||
<v-list-tile-title v-on:click.stop="openModal(item.name, item.fullSynopsis)">
|
||||
<v-list-tile v-on:click.native="openModal(item.name, item.fullSynopsis)">
|
||||
<v-list-tile-title>
|
||||
Check synopsis
|
||||
</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
<v-list-tile>
|
||||
<v-list-tile-title v-on:click.stop="downloadAll(item.rawName)">
|
||||
<v-list-tile v-on:click.native="downloadAll(item.rawName)">
|
||||
<v-list-tile-title>
|
||||
Download all episodes
|
||||
</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
|
@ -173,6 +173,7 @@
|
|||
},
|
||||
watch: {
|
||||
releases: function () {
|
||||
// Update time whenever KawAnime receives new releases.
|
||||
const newTime = (new Date()).toLocaleTimeString()
|
||||
this.$store.commit('setReleasesUpdateTime', newTime)
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
|
@ -14,6 +14,7 @@ const log = (message) => {
|
|||
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
autoRefreshReleases: true,
|
||||
releaseFansub: '',
|
||||
releaseQuality: '',
|
||||
releases: [],
|
||||
|
@ -208,8 +209,11 @@ const store = new Vuex.Store({
|
|||
|
||||
const {data, status} = await axios.get(`getLatest.json?quality=${state.releaseQuality}`)
|
||||
|
||||
if (status === 200) commit('setReleases', data)
|
||||
else if (status === 204) {
|
||||
if (status === 200) {
|
||||
commit('setReleases', data)
|
||||
|
||||
if (state.autoRefreshReleases === true) dispatch('autoRefreshReleases')
|
||||
} else if (status === 204) {
|
||||
log(`An error occurred while getting the latest releases. Retrying in 45 seconds.`)
|
||||
commit('setInfoSnackbar', 'Could not get the latest releases. Retrying in 45 seconds.')
|
||||
setTimeout(function () {
|
||||
|
@ -263,6 +267,19 @@ const store = new Vuex.Store({
|
|||
}, 45 * 1000)
|
||||
}
|
||||
},
|
||||
async autoRefreshReleases ({dispatch, commit, state}) {
|
||||
// Refresh releases every 30 minutes
|
||||
setTimeout(async () => {
|
||||
log(`Refreshing Releases...`)
|
||||
|
||||
const {data} = await axios.get(`getLatest.json?quality=${state.releaseQuality}`)
|
||||
|
||||
if (data.length === 18) {
|
||||
commit('setReleases', data)
|
||||
dispatch('autoRefreshReleases')
|
||||
}
|
||||
}, 30 * 60 * 1000)
|
||||
},
|
||||
async refreshSeasons ({state, commit}) {
|
||||
log(`Refreshing Seasons...`)
|
||||
|
||||
|
|
Loading…
Reference in New Issue