Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
โ€ฆeng-dong into feature/#319
  • Loading branch information
pakxe committed Aug 16, 2024
2 parents fa6262b + ee322f6 commit 0caac4a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/src/apis/request/member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const requestDeleteAllMemberList = async ({eventId, memberName}: WithEven
};

export type ResponseGetCurrentInMemberList = {
members: Array<{name: string}>;
memberNames: string[];
};

export const requestGetCurrentInMemberList = async (eventId: string) => {
Expand Down
12 changes: 5 additions & 7 deletions client/src/hooks/useSearchInMemberList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ const useSearchInMemberList = (
const [currentInputIndex, setCurrentInputIndex] = useState(-1);

// ์„œ๋ฒ„์—์„œ ๊ฐ€์ ธ์˜จ ์ „์ฒด ๋ฆฌ์ŠคํŠธ
const [currentInMemberList, setCurrentInMemberList] = useState<Array<{name: string}>>([]);
const [currentInMemberList, setCurrentInMemberList] = useState<Array<string>>([]);

// ๊ฒ€์ƒ‰๋œ ๋ฆฌ์ŠคํŠธ (๋”ฐ๋กœ ๋‘” ์ด์œ ๋Š” ๊ฒ€์ƒ‰ ํ›„ ํด๋ฆญํ–ˆ์„ ๋•Œ ๋ฆฌ์ŠคํŠธ๋ฅผ ๋น„์›Œ์ฃผ์–ด์•ผํ•˜๊ธฐ ๋•Œ๋ฌธ)
const [filteredInMemberList, setFilteredInMemberList] = useState<Array<string>>([]);

useEffect(() => {
const getCurrentInMembers = async () => {
const currentInMemberListFromServer = await fetch({queryFunction: () => requestGetCurrentInMemberList(eventId)});
setCurrentInMemberList(currentInMemberListFromServer.members);
setCurrentInMemberList(currentInMemberListFromServer.memberNames);
};

getCurrentInMembers();
Expand All @@ -39,11 +39,9 @@ const useSearchInMemberList = (
const filterMatchItems = (keyword: string) => {
if (keyword.trim() === '') return [];

const MatchItems = currentInMemberList.map(({name}) => name);

return MatchItems.filter(
matchItem => matchItem.toLocaleLowerCase().indexOf(keyword.toLocaleLowerCase()) > -1,
).slice(0, 3);
return currentInMemberList
.filter(member => member.toLocaleLowerCase().indexOf(keyword.toLocaleLowerCase()) > -1)
.slice(0, 3);
};

const chooseMember = (inputIndex: number, name: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const CompleteCreateEventPage = () => {

const {showToast} = useToast();

const homePageUrl = getEventPageUrlByEnvironment(url, 'home');
const homePageUrl = getEventPageUrlByEnvironment(eventId ?? '', 'home');

return (
<MainLayout>
Expand Down

0 comments on commit 0caac4a

Please sign in to comment.