Skip to content

Commit

Permalink
fix: Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
cjeongmin committed May 21, 2024
1 parent 21aca89 commit 5e2191e
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions src/app/pages/mobile/mobile-shared-post-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styled from 'styled-components';

import { Bookmark, CircularProfileImage } from '@/components';
import { ImageGrid } from '@/components/shared-post-page';
import { useAuthValue, useUserData } from '@/features/auth';
import { useAuthValue } from '@/features/auth';
import { useCreateChatRoom } from '@/features/chat';
import { fromAddrToCoord } from '@/features/geocoding';
import { useFollowUser, useUnfollowUser } from '@/features/profile';
Expand Down Expand Up @@ -445,15 +445,6 @@ export function MobileSharedPostPage({
enabled: type === 'dormitory' && auth?.accessToken != null,
});

const { data: userData } = useUserData(auth?.accessToken != null);
const [userId, setUserId] = useState<string>('');

useEffect(() => {
if (userData != null) {
setUserId(userData.memberId);
}
}, [userData]);

useEffect(() => {
if (sharedPost?.data.address.roadAddress != null) {
fromAddrToCoord({ query: sharedPost?.data.address.roadAddress }).then(
Expand All @@ -474,16 +465,7 @@ export function MobileSharedPostPage({
}
}, [sharedPost]);

const [roomName, setRoomName] = useState<string>('');

useEffect(() => {
if (sharedPost !== undefined) {
setRoomName(sharedPost.data.publisherAccount.nickname);
}
}, [sharedPost]);

const members = [userId];
const { mutate: chattingMutate } = useCreateChatRoom(roomName, members);
const { mutate: chattingMutate } = useCreateChatRoom();

const isLoading = useMemo(
() =>
Expand Down Expand Up @@ -574,7 +556,12 @@ export function MobileSharedPostPage({
</div>
<styles.chattingButton
onClick={() => {
chattingMutate();
if (selected == null) return;

chattingMutate({
roomName: selected.nickname,
members: [selected.memberId],
});
}}
>
채팅
Expand Down

0 comments on commit 5e2191e

Please sign in to comment.