Fix offline mecanics

This commit is contained in:
Kylart 2017-12-09 00:58:03 +01:00
parent f6d05c9957
commit 22732f566f
4 changed files with 25 additions and 15 deletions

View File

@ -16,6 +16,10 @@ h3
font-size 42px font-size 42px
font-weight 500 font-weight 500
h4
font-size 36px
font-weight 400
h5 h5
font-size 24px font-size 24px
font-weight 400 font-weight 400

View File

@ -47,7 +47,7 @@
template(v-for='link in getLinks(name)') template(v-for='link in getLinks(name)')
v-flex(xs11).mt-1.pa-0.ep-name {{ link.name }} v-flex(xs11).mt-1.pa-0.ep-name {{ link.name }}
v-flex(xs1) v-flex(xs1)
v-checkbox.pt-0.primary--text(v-model='selected', :value='link.link', label='', hide-details) v-checkbox.pt-0.primary--text(v-model='selected', :value='link.link', label='', color='orange', hide-details)
v-flex(xs1) v-flex(xs1)
v-flex.mt-1.mb-2.pa-0.ep-magnet.ellipsis(xs11) #[a.white--text(:href='link.link') {{ link.link }}] v-flex.mt-1.mb-2.pa-0.ep-magnet.ellipsis(xs11) #[a.white--text(:href='link.link') {{ link.link }}]
v-card-actions v-card-actions

View File

@ -88,8 +88,8 @@
v-btn.change-dir-button(flat, dark, @click='changePath()') v-btn.change-dir-button(flat, dark, @click='changePath()')
| Change dir | Change dir
v-flex.empty-message(xs12) v-flex.empty-message(xs12)
h3.white--text Wow such empty! h3 Wow such empty!
h4.white--text h4
| Start downloading anime  | Start downloading anime 
router-link.green--text(to='/downloader') here router-link.green--text(to='/downloader') here
|  or  |  or 

View File

@ -2,7 +2,7 @@
* Created by Kylart on 26/07/2017. * Created by Kylart on 26/07/2017.
*/ */
import {axios} from './utils' import {axios, log} from './utils'
export default { export default {
async init ({commit, dispatch}) { async init ({commit, dispatch}) {
@ -29,24 +29,30 @@ export default {
dispatch('player/setUp').catch(err => { void err }) dispatch('player/setUp').catch(err => { void err })
// Online // Online
dispatch('online').catch(err => { void err })
},
async online ({commit, dispatch}) {
try { try {
const {status} = await axios.get('_isOnline') const {status} = await axios.get('_isOnline')
if (status === 200) { if (status === 200) {
commit('setConnected', true) commit('setConnected', true)
dispatch('online')
dispatch('logs/init').catch(err => { void err })
dispatch('releases/init').catch(err => { void err })
dispatch('seasons/init').catch(err => { void err })
dispatch('news/init').catch(err => { void err })
dispatch('mal/init').catch(err => { void err })
} else { } else {
commit('setInfoSnackbar', 'No internet access. Retrying in 1 minutes.') commit('setInfoSnackbar', 'No internet access. Retrying in 1 minute.')
setTimeout(() => { dispatch('online') }, 60 * 1000) setTimeout(() => { dispatch('online') }, 60 * 1000)
} }
} catch (e) { void e } } catch (e) {
}, log('An error occurred while reaching _isOnline.', e)
async online ({dispatch}) { commit('setInfoSnackbar', 'An unknown error occurred, please restart KawAnime.')
dispatch('logs/init').catch(err => { void err }) setTimeout(() => { dispatch('online') }, 60 * 1000)
dispatch('releases/init').catch(err => { void err }) }
dispatch('seasons/init').catch(err => { void err })
dispatch('news/init').catch(err => { void err })
dispatch('mal/init').catch(err => { void err })
}, },
async getEnv ({commit}) { async getEnv ({commit}) {
const {data} = await axios.get('_env') const {data} = await axios.get('_env')