Skip to content

Commit

Permalink
개설자 본인은 공동 모임장 검색이 되지 않도록 구현 (#949)
Browse files Browse the repository at this point in the history
* feat: 본인은 공동 모임장 검색이 되지 않도록 구현

* fix: 빌드 에러 해결

* feat: 멘션 유저 타입 정의(any 삭제)
  • Loading branch information
ocahs9 authored Nov 13, 2024
1 parent fabcf36 commit 0de7c92
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/api/API_LEGACY/meeting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ export const createMeeting = async (formData: FormType) => {

export const updateMeeting = async (meetingId: string, formData: FormType) => {
const response = await api.put(`/meeting/v2/${meetingId}`, serializeFormData(formData));

return response;
};

Expand Down
17 changes: 15 additions & 2 deletions src/components/form/Presentation/CoLeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { IconXCircle } from '@sopt-makers/icons';
import { useQueryGetMentionUsers } from '@api/user/hooks';
import { fontsObject } from '@sopt-makers/fonts';
import { IconXClose } from '@sopt-makers/icons';
import { useQueryMyProfile } from '@api/API_LEGACY/user/hooks';

interface CoLeaderFieldProps {
value: mentionableDataType[];
Expand All @@ -27,8 +28,20 @@ interface mentionableDataType {
userprofileImage?: string;
}

interface metionUserType {
userId: number;
orgId: number;
userName: string;
recentPart: string;
recentGeneration: number;
profileImageUrl: string;
}

const CoLeader = ({ value: coLeaders = [], onChange, error }: CoLeaderFieldProps) => {
const { data: user } = useQueryMyProfile();
const { data: mentionUserList } = useQueryGetMentionUsers();
//API 연결에서 타입을 지정해두지 않았기 때문에 any 이용
const filteredMeList = mentionUserList?.filter((mentionUser: metionUserType) => mentionUser.userId !== user?.id);

const handleUserSelect = (user: mentionableDataType) => {
if (coLeaders.length < 3 && !coLeaders.some(leader => leader.id === user.id)) {
Expand Down Expand Up @@ -87,7 +100,7 @@ const CoLeader = ({ value: coLeaders = [], onChange, error }: CoLeaderFieldProps
<CommentInput onClick={e => e.stopPropagation()}>
<InputBox isActive={comment !== ''}>
<SearchMention
mentionUserList={mentionUserList}
mentionUserList={filteredMeList}
inputRef={inputRef}
value={comment}
setValue={setComment}
Expand All @@ -112,7 +125,7 @@ const CoLeader = ({ value: coLeaders = [], onChange, error }: CoLeaderFieldProps
<CommentInput onClick={e => e.stopPropagation()}>
<InputBox isActive={comment !== ''}>
<SearchMention
mentionUserList={mentionUserList}
mentionUserList={filteredMeList}
inputRef={inputRef}
value={comment}
setValue={setComment}
Expand Down

0 comments on commit 0de7c92

Please sign in to comment.