diff --git a/store/modules/news/actions.js b/store/modules/news/actions.js index 84015a8..5f7dc40 100644 --- a/store/modules/news/actions.js +++ b/store/modules/news/actions.js @@ -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 + } + }) } }