mirror of https://github.com/Kylart/KawAnime.git
fix news actions
This commit is contained in:
parent
8bab497b19
commit
7983a43233
|
@ -1,7 +1,7 @@
|
|||
import {axios, log} from '../../utils'
|
||||
|
||||
export default {
|
||||
async init ({state, commit, dispatch}) {
|
||||
async init ({commit, dispatch}) {
|
||||
console.log('[INIT] News')
|
||||
|
||||
try {
|
||||
|
@ -11,11 +11,11 @@ export default {
|
|||
commit('set', data)
|
||||
} else {
|
||||
log('A problem occurred while gathering the news.')
|
||||
setTimeout(() => { dispatch('init') })
|
||||
setTimeout(() => { dispatch('init') }, 30 * 1000)
|
||||
}
|
||||
} catch (e) {
|
||||
log('A problem occurred while gathering the news.')
|
||||
setTimeout(() => { dispatch('init') })
|
||||
setTimeout(() => { dispatch('init') }, 30 * 1000)
|
||||
}
|
||||
},
|
||||
async refresh ({commit, dispatch}) {
|
||||
|
@ -27,15 +27,16 @@ export default {
|
|||
|
||||
status === 200
|
||||
? commit('set', data)
|
||||
: log('A problem occurred while gathering the news.') && dispatch('refresh')
|
||||
: log('A problem occurred while gathering the news.') && setTimeout(() => { dispatch('refresh') }, 30 * 1000)
|
||||
},
|
||||
async openLink ({rootState}, link) {
|
||||
log(`Opening ${link}`)
|
||||
log(`Opening ${link}.`)
|
||||
|
||||
await axios.get(
|
||||
rootState.config.config.inside
|
||||
? `openThis?type=insideLink&link=${link}`
|
||||
: `openThis?type=link&link=${link}`
|
||||
)
|
||||
await axios.get('openThis', {
|
||||
params: {
|
||||
type: rootState.config.config.inside ? 'inside' : 'link',
|
||||
link
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue