mid 관련 수정
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { ChangeEvent, useEffect, useState } from 'react';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
||||
@@ -8,16 +8,17 @@ import { UserListItem } from '@/entities/user/model/types';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
|
||||
export const UserManageWrap = () => {
|
||||
const { navigate } = useNavigate();
|
||||
const midOptions = useStore.getState().UserStore.selectOptionsMids;
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
|
||||
const { navigate } = useNavigate();
|
||||
const { mutateAsync: userFind } = useUserFindMutation();
|
||||
|
||||
const [mid, setMid] = useState<string>(userMid);
|
||||
const [userItems, setUserItems] = useState<Array<UserListItem>>([]);
|
||||
const [pageParam, setPageParam] = useState(DEFAULT_PAGE_PARAM);
|
||||
const [mid, setMid] = useState<string>(userMid);
|
||||
|
||||
const { mutateAsync: userFind } = useUserFindMutation();
|
||||
|
||||
const callList = (mid: string) => {
|
||||
const callList = () => {
|
||||
setPageParam(pageParam);
|
||||
userFind({ mid: mid, page: pageParam }).then((rs) => {
|
||||
console.log('API Response:', rs);
|
||||
@@ -35,7 +36,7 @@ export const UserManageWrap = () => {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
callList(mid);
|
||||
callList();
|
||||
}, [mid]);
|
||||
|
||||
return (
|
||||
@@ -44,15 +45,14 @@ export const UserManageWrap = () => {
|
||||
<div style={{ flexShrink: 0 }}>
|
||||
<div className="input-wrapper top-select mt-16">
|
||||
<select
|
||||
value={mid}
|
||||
onChange={e => setMid(e.target.value)}
|
||||
value={ mid }
|
||||
onChange={ (e: ChangeEvent<HTMLSelectElement>) => setMid(e.target.value)}
|
||||
>
|
||||
{
|
||||
midOptions.map((value, index) => (
|
||||
<option
|
||||
key={ value.value }
|
||||
value={ value.value }
|
||||
selected={ (userMid === value.value)? true: false }
|
||||
>{ value.name }</option>
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user