Skip to content

Commit 1e334ff

Browse files
committed
remove getTopPosts Api
1 parent 9a4231f commit 1e334ff

File tree

6 files changed

+0
-31
lines changed

6 files changed

+0
-31
lines changed

src/api/postsApis.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import axios from 'axios';
33
import {
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-
2419
export const allTagPostsData = (tagName) => {
2520
return axios.get(_allTagPostsData.replace('{tagName}', tagName));
2621
}

src/api/urls.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export const loginUser = config.BASE_URL + '/api/auth';
1212
// Posts
1313
export const allPostsData = config.BASE_URL + '/api/posts';
1414
export const singlePostData = config.BASE_URL + '/api/posts/{id}';
15-
export const allTopPostsData = config.BASE_URL + '/api/posts/top';
1615
export const allTagPostsData = config.BASE_URL + '/api/posts/tag/{tagName}';
1716
export const createSinglePost = config.BASE_URL + '/api/posts';
1817
export const deleteSinglePost = config.BASE_URL + '/api/posts/{id}';

src/redux/posts/posts.actions.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { setAlert } from "../alert/alert.actions";
22
import {
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 {
1110
import {
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
7857
export const getTagPosts = (tagName) => async (dispatch) => {
7958
try {

src/redux/posts/posts.reducer.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {
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 = {
1817
export 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,

src/redux/posts/posts.types.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export const GET_POSTS = 'GET_POSTS';
22
export const GET_POST = 'GET_POST';
3-
export const GET_TOP_POSTS = 'GET_TOP_POSTS';
43
export const GET_TAG_POSTS = 'GET_TAG_POSTS';
54
export const POST_ERROR = 'POST_ERROR';
65
export const DELETE_POST = 'DELETE_POST';

src/redux/tags/tags.actions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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({

0 commit comments

Comments
 (0)