123456789101112131415161718192021222324252627282930313233343536 |
- import axios from '~plugins/axios'
- export const actions = {
- loadAllNews ({ commit }, params = {}) {
- commit('newsPage/REQUEST_ALLNEWS')
- return axios.get('/api/news/created', {params})
- .then(response => {
- commit('newsPage/GET_ALLNEWS_SUCCESS', response.data)
- }, err => {
- commit('newsPage/GET_ALLNEWS_FAILURE', err)
- })
- },
-
- loadDetailNews ({ commit }, params = {}) {
- let id = params.id
- commit('detailNews/REQUEST_DETAILNEWS', params)
- return axios.get(`/api/news/${id}`)
- .then(response => {
- commit('detailNews/GET_DETAILNEWS_SUCCESS', response.data)
- }, err => {
- commit('detailNews/GET_DETAILNEWS_FAILURE', err)
- })
- },
-
- loadHotNews ({ commit }, params = {}) {
- commit('hotNews/REQUEST_HOTNEWS')
- return axios.get('/api/news/viewCount', {params})
- .then(response => {
- commit('hotNews/GET_HOTNEWS_SUCCESS', response.data)
- }, err => {
- commit('hotNews/GET_HOTNEWS_FAILURE', err)
- })
- }
- }
|