- 사용자 로그인 인증정보 관리 기능 구현 (이메일/휴대폰 추가/삭제) - 사용자 추가 기능 구현 (실시간 ID 중복 검증 포함) - 사용자 목록 조회 기능 구현 - API 엔드포인트 오류 수정 (userExistsUserid: GET → POST, URL 경로 수정) - TypeScript 타입 오류 수정 (UseQueryOptions, UserCreateParams/Response) - 이메일/휴대폰 형식 검증 및 중복 방지 로직 추가 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
import { useEffect, useState } from 'react';
|
|
import { PATHS } from '@/shared/constants/paths';
|
|
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
|
import { AuthItem } from '../model/types';
|
|
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
|
import { UserManageAuthList } from './user-manage-auth-list';
|
|
import { useUserFindMutation } from '@/entities/user/api/use-user-find-mutation';
|
|
import { UserListItem } from '@/entities/user/model/types';
|
|
|
|
export const UserManageWrap = () => {
|
|
const { navigate } = useNavigate();
|
|
const { mutateAsync: userFind } = useUserFindMutation();
|
|
const [userItems, setUserItems] = useState<Array<UserListItem>>([]);
|
|
const [pageParam, setPageParam] = useState(DEFAULT_PAGE_PARAM);
|
|
const [mid, setMid] = useState<string>('nictest00m');
|
|
|
|
const midList = [
|
|
{ value: 'nictest00m', label: 'nictest00m' },
|
|
{ value: 'nictest01m', label: 'nictest01m' },
|
|
{ value: 'nictest02m', label: 'nictest02m' },
|
|
];
|
|
|
|
const callList = (mid: string) => {
|
|
setPageParam(pageParam);
|
|
userFind({ mid: mid, page: pageParam }).then((rs) => {
|
|
setUserItems(rs.content || []);
|
|
});
|
|
};
|
|
|
|
const onClickToNavigation = () => {
|
|
navigate(PATHS.account.user.addAccount);
|
|
};
|
|
|
|
useEffect(() => {
|
|
callList(mid);
|
|
}, [mid]);
|
|
|
|
return (
|
|
<>
|
|
<div className="ing-list">
|
|
<div className="input-wrapper top-select mt-16">
|
|
<select value={mid} onChange={e => setMid(e.target.value)}>
|
|
{midList.map(item => (
|
|
<option key={item.value} value={item.value}>{item.label}</option>
|
|
))}
|
|
</select>
|
|
</div>
|
|
|
|
<div className="ing-title">등록 현황</div>
|
|
{ (!!userItems && userItems.length > 0) &&
|
|
<UserManageAuthList
|
|
userItems={ userItems }
|
|
mid={ mid }
|
|
></UserManageAuthList>
|
|
}
|
|
<div className="apply-row bottom-padding">
|
|
<button
|
|
className="btn-50 btn-blue flex-1"
|
|
onClick={ () => onClickToNavigation() }
|
|
>사용자 추가</button>
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
}; |