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-weight 500
h4
font-size 36px
font-weight 400
h5
font-size 24px
font-weight 400

View File

@ -47,7 +47,7 @@
template(v-for='link in getLinks(name)')
v-flex(xs11).mt-1.pa-0.ep-name {{ link.name }}
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.mt-1.mb-2.pa-0.ep-magnet.ellipsis(xs11) #[a.white--text(:href='link.link') {{ link.link }}]
v-card-actions

View File

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

View File

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