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

개설자 본인은 공동 모임장 검색이 되지 않도록 구현 #949

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading