//사용자 관리 - 사용자 조회 api 연결 import { Axios } from '../utils'; // 운영자 조회 export const AdminViewList = async (token, searchType, searchKey, groupType, joinCheck, orderBy, size, currentPage) => { try { const res = await Axios.get( `/api/v1/admin/list?search_type=${searchType ? searchType : 'NAME'}&search_key=${searchKey ? searchKey : ''}&group_id=${groupType ? groupType : ''}&join_check=${joinCheck}&orderby=${ orderBy ? orderBy : 'DESC' }&page_no=${currentPage}&page_size=${size}`, { headers: { Authorization: `Bearer ${token}` }, }, ); return res.data.data; } catch (e) { if (e instanceof Error) { throw new Error('AdminViewList Error', e); } } }; export const AdminViewGroupList = async token => { try { const res = await Axios.get('/api/v1/admin/group-list', { headers: { Authorization: `Bearer ${token}` }, }); return res.data.data.group_list; } catch (e) { if (e instanceof Error) { throw new Error('AdminViewGroupList Error', e); } } }; export const AdminLoginApprove = async (token, params) => { try { const res = await Axios.patch( '/api/v1/admin', { list: params }, { headers: { Authorization: `Bearer ${token}` }, }, ); return res; } catch (e) { if (e instanceof Error) { throw new Error('AdminLoginApprove Error', e); } } }; export const AdminChangeGroup = async (token, params) => { try { const res = await Axios.put( '/api/v1/admin', { list: params }, { headers: { Authorization: `Bearer ${token}` }, }, ); return res; } catch (e) { if (e instanceof Error) { throw new Error('AdminChangeGroup Error', e); } } }; export const AdminDeleteUser = async (token, params) => { try { const res = await Axios.delete('/api/v1/admin', { headers: { Authorization: `Bearer ${token}` }, data: { list: params }, }); return res; } catch (e) { if (e instanceof Error) { throw new Error('AdminDeleteUser Error', e); } } }; export const AdminChangePw = async (token, params) => { try { const res = await Axios.post('/api/v1/admin/init-password', params, { headers: { Authorization: `Bearer ${token}` }, }); return res.data; } catch (e) { if (e instanceof Error) { throw new Error('AdminChangePw Error', e); } } };