Updated redux gab_trends -> gab for our services

• Updated:
- redux gab_trends -> gab for our services
- TrendsPanel to use updated route
This commit is contained in:
mgabdev
2020-09-10 17:21:39 -05:00
parent 793f46253c
commit fb8c705ebf
4 changed files with 59 additions and 8 deletions

View File

@@ -1,9 +1,14 @@
import api from '../api'
import axios from 'axios'
export const GAB_TRENDS_RESULTS_FETCH_REQUEST = 'GAB_TRENDS_RESULTS_FETCH_REQUEST'
export const GAB_TRENDS_RESULTS_FETCH_SUCCESS = 'GAB_TRENDS_RESULTS_FETCH_SUCCESS'
export const GAB_TRENDS_RESULTS_FETCH_FAIL = 'GAB_TRENDS_RESULTS_FETCH_FAIL'
export const GAB_NEWS_RESULTS_FETCH_REQUEST = 'GAB_NEWS_RESULTS_FETCH_REQUEST'
export const GAB_NEWS_RESULTS_FETCH_SUCCESS = 'GAB_NEWS_RESULTS_FETCH_SUCCESS'
export const GAB_NEWS_RESULTS_FETCH_FAIL = 'GAB_NEWS_RESULTS_FETCH_FAIL'
export const fetchGabTrends = (feedType) => {
return function (dispatch, getState) {
dispatch(fetchGabTrendsRequest(feedType))
@@ -39,4 +44,36 @@ function fetchGabTrendsFail(error, feedType) {
error,
feedType,
}
}
export const fetchGabNews = () => {
return function (dispatch) {
dispatch(fetchGabNewsRequest())
axios.get('https://news.gab.com/feed/json').then((response) => {
dispatch(fetchGabNewsSuccess(response.data))
}).catch(function (error) {
dispatch(fetchGabNewsFail(error))
})
}
}
function fetchGabNewsRequest() {
return {
type: GAB_NEWS_RESULTS_FETCH_REQUEST,
}
}
function fetchGabNewsSuccess(items) {
return {
type: GAB_NEWS_RESULTS_FETCH_SUCCESS,
items,
}
}
function fetchGabNewsFail(error) {
return {
type: GAB_NEWS_RESULTS_FETCH_FAIL,
error,
}
}