Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Frontend] Display the post content when reporting #575

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

badukwei
Copy link
Collaborator

@badukwei badukwei commented Nov 6, 2024

Summary

  1. 在 report 開始時顯示 report 說明。
  2. 在 report form 中新增貼文內容。

Linked Issue

close #560

Copy link
Collaborator

@Xiawpohr Xiawpohr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution

@@ -29,9 +34,12 @@ const defaultValues = {

export function PostReportDialog({
postId,
content,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建議可以使用 tanstack-query 來取得 post 的內容,以避免 prop drilling 的情況。你可以封裝以下 hook 來實作,例如:

function usePostById(id: string) {
    return useQuery({
        queryKey: [QueryKeys.SinglePost, id],
        queryFn: async () => {
            if (!id) return undefined
            const postService = new PostService()
            return postService.fetchPostById(id)
        },
    })
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UST-243] [Frontend] Display the post content when reporting
2 participants