Skip to content

Commit

Permalink
Add fetchUserReplies
Browse files Browse the repository at this point in the history
  • Loading branch information
dvque committed Feb 2, 2024
1 parent ba2bda3 commit a63db24
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ export const THREADS_APP_ID = '238260118697367';
export const ENDPOINTS_DOCUMENT_ID = {
USER_THREADS: '6451898791498605',
USER_PROFILE: '23996318473300828',
THREADS_REPLIES: '6529829603744567'
THREADS_REPLIES: '6529829603744567',
USER_REPLIES: '6684830921547925'
}
8 changes: 8 additions & 0 deletions src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ export const fetchUserThreads = async ({ userId, userName }: fetchUserParams) =>
return fetchBase({ documentId: ENDPOINTS_DOCUMENT_ID.USER_THREADS, variables })
}

export const fetchUserReplies = async ({ userId, userName }: fetchUserParams) => {
if(userName && !userId) {
userId = await fetchUserIdByName({ userName });
}
const variables = JSON.stringify({ userID: userId });
return fetchBase({ documentId: ENDPOINTS_DOCUMENT_ID.USER_REPLIES, variables })
}

export const fetchThreadReplies = ({ threadId }: { threadId: string }) => {
const variables = JSON.stringify({ postID: threadId });
return fetchBase({ documentId: ENDPOINTS_DOCUMENT_ID.THREADS_REPLIES, variables })
Expand Down

0 comments on commit a63db24

Please sign in to comment.