Skip to content

Commit

Permalink
fix: api changes #430
Browse files Browse the repository at this point in the history
fixed api changes
  • Loading branch information
jasirtp committed Nov 11, 2021
1 parent 8a3cd7f commit 928f9fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pages/posts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ export default function Posts() {
getPosts(newReqData);
}, [router.query.page, router.query.tag, router.query.status]);

async function getPosts(reqData) {
async function getPosts(ReqData) {
// console.log("getposts call");
try {
const userId = userCookie.id;
console.log("user",userId);
const data = await PostService.getUserPostsByUserId(userId, reqData);
const data = await PostService.getUserPostsByUserId(ReqData, userId);
const { posts, count } = data.data;
console.log({ posts });
if (data) {
Expand All @@ -106,7 +106,7 @@ export default function Posts() {
}
}

console.log('change page', postData);
console.log('change page', postData.posts);

const changePage = (newPageNo) => {
// console.log("change page: ", newPageNo, tagFilter, statusFilter);
Expand Down
7 changes: 5 additions & 2 deletions services/PostService.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,12 @@ async function getPostsByQuery(query, clickNo) {
* @param {String} username
* @returns {Promise}
*/
async function getUserPostsByUserId(userId, reqData) {
async function getUserPostsByUserId(ReqData, userId) {

try {
const { data } = await axios.get(`${baseUrl}/${postUser}/${userId}`,reqData);
const { data } = await axios.get(`${baseUrl}/${postUser}/${userId}`, {
params: ReqData
});
return data;
} catch (err) {
console.log(err);
Expand Down

0 comments on commit 928f9fb

Please sign in to comment.