File tree Expand file tree Collapse file tree 6 files changed +0
-31
lines changed Expand file tree Collapse file tree 6 files changed +0
-31
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import axios from 'axios';
33import {
44 allPostsData as _allPostsData ,
55 singlePostData as _singlePostData ,
6- allTopPostsData as _allTopPostsData ,
76 allTagPostsData as _allTagPostsData ,
87 createSinglePost as _createSinglePost ,
98 deleteSinglePost as _deleteSinglePost
@@ -17,10 +16,6 @@ export const singlePostData = (id) => {
1716 return axios . get ( _singlePostData . replace ( '{id}' , id ) ) ;
1817}
1918
20- export const allTopPostsData = ( ) => {
21- return axios . get ( _allTopPostsData ) ;
22- }
23-
2419export const allTagPostsData = ( tagName ) => {
2520 return axios . get ( _allTagPostsData . replace ( '{tagName}' , tagName ) ) ;
2621}
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ export const loginUser = config.BASE_URL + '/api/auth';
1212// Posts
1313export const allPostsData = config . BASE_URL + '/api/posts' ;
1414export const singlePostData = config . BASE_URL + '/api/posts/{id}' ;
15- export const allTopPostsData = config . BASE_URL + '/api/posts/top' ;
1615export const allTagPostsData = config . BASE_URL + '/api/posts/tag/{tagName}' ;
1716export const createSinglePost = config . BASE_URL + '/api/posts' ;
1817export const deleteSinglePost = config . BASE_URL + '/api/posts/{id}' ;
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import { setAlert } from "../alert/alert.actions";
22import {
33 GET_POSTS ,
44 GET_POST ,
5- GET_TOP_POSTS ,
65 GET_TAG_POSTS ,
76 POST_ERROR ,
87 DELETE_POST ,
@@ -11,7 +10,6 @@ import {
1110import {
1211 allPostsData ,
1312 singlePostData ,
14- allTopPostsData ,
1513 allTagPostsData ,
1614 createSinglePost ,
1715 deleteSinglePost
@@ -55,25 +53,6 @@ export const getPost = (id) => async (dispatch) => {
5553 }
5654} ;
5755
58- //GET TOP POSTS
59- export const getTopPosts = ( ) => async ( dispatch ) => {
60- try {
61- const res = await allTopPostsData ( ) ;
62-
63- dispatch ( {
64- type : GET_TOP_POSTS ,
65- payload : res . data . data ,
66- } ) ;
67- } catch ( err ) {
68- dispatch ( setAlert ( err . response . data . message , "danger" ) ) ;
69-
70- dispatch ( {
71- type : POST_ERROR ,
72- payload : { msg : err . response . statusText , status : err . response . status } ,
73- } ) ;
74- }
75- } ;
76-
7756//GET TAG POSTS
7857export const getTagPosts = ( tagName ) => async ( dispatch ) => {
7958 try {
Original file line number Diff line number Diff line change 11import {
22 GET_POSTS ,
33 GET_POST ,
4- GET_TOP_POSTS ,
54 GET_TAG_POSTS ,
65 POST_ERROR ,
76 DELETE_POST ,
@@ -18,7 +17,6 @@ const initialState = {
1817export default function posts ( state = initialState , action ) {
1918 switch ( action . type ) {
2019 case GET_POSTS :
21- case GET_TOP_POSTS :
2220 case GET_TAG_POSTS :
2321 return {
2422 ...state ,
Original file line number Diff line number Diff line change 11export const GET_POSTS = 'GET_POSTS' ;
22export const GET_POST = 'GET_POST' ;
3- export const GET_TOP_POSTS = 'GET_TOP_POSTS' ;
43export const GET_TAG_POSTS = 'GET_TAG_POSTS' ;
54export const POST_ERROR = 'POST_ERROR' ;
65export const DELETE_POST = 'DELETE_POST' ;
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ export const getTag = (tagName) => async (dispatch) => {
1111 payload : res . data . data ,
1212 } ) ;
1313 } catch ( err ) {
14- // dispatch(() => history.push('/questions'))
1514 dispatch ( setAlert ( err . response . data . message , 'danger' ) ) ;
1615
1716 dispatch ( {
You can’t perform that action at this time.
0 commit comments