Skip to content

Commit 527ec9a

Browse files
committed
fix: omit postId, return user when follow/unfollow
1 parent 317a87e commit 527ec9a

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/components/common/FollowButton.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ import { themedPalette } from '../../lib/styles/themes';
1212
export interface PostFollowButtonProps {
1313
followingUserId: string;
1414
followed: boolean | undefined;
15-
postId: string;
1615
}
1716

1817
const FollowButton: React.FC<PostFollowButtonProps> = ({
1918
followingUserId,
2019
followed,
21-
postId,
2220
}) => {
2321
const client = useApolloClient();
2422
const currentUser = useUser();
@@ -52,7 +50,6 @@ const FollowButton: React.FC<PostFollowButtonProps> = ({
5250

5351
const variables = {
5452
following_user_id: followingUserId,
55-
post_id: postId,
5653
};
5754

5855
const followFragment = gql`

src/containers/post/PostViewer.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ const PostViewer: React.FC<PostViewerProps> = ({
429429
<FollowButton
430430
followed={post.user.is_followed}
431431
followingUserId={post.user.id}
432-
postId={post.id}
433432
/>
434433
}
435434
/>
@@ -447,7 +446,6 @@ const PostViewer: React.FC<PostViewerProps> = ({
447446
<FollowButton
448447
followed={post.user.is_followed}
449448
followingUserId={post.user.id}
450-
postId={post.id}
451449
/>
452450
}
453451
/>

src/lib/graphql/user.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,18 @@ export const CONFIRM_CHANGE_EMAIL = gql`
185185

186186
export const FOLLOW_USER = gql`
187187
mutation Follow($following_user_id: ID!, $post_id: ID!) {
188-
follow(following_user_id: $following_user_id, post_id: $post_id) {
188+
follow(following_user_id: $following_user_id) {
189189
id
190+
is_followed
190191
}
191192
}
192193
`;
193194

194195
export const UNFOLLOW_USER = gql`
195196
mutation Unfollow($following_user_id: ID!, $post_id: ID!) {
196-
unfollow(following_user_id: $following_user_id, post_id: $post_id) {
197+
unfollow(following_user_id: $following_user_id) {
197198
id
199+
is_followed
198200
}
199201
}
200202
`;

0 commit comments

Comments
 (0)