refactor: 모듈 타입별 아이템 목록 조회 api의 req param을 배열로 변경
This commit is contained in:
parent
d6b4a03293
commit
371f1eb202
@ -215,7 +215,7 @@ export default function Playground() {
|
||||
<button
|
||||
className="btn-frame deepgray"
|
||||
onClick={() => {
|
||||
getModuleTypeItemList('ROOF_ID_HIRA_SEME')
|
||||
getModuleTypeItemList(['ROOF_ID_HIRA_SEME', 'ROOF_ID_ROOGA'])
|
||||
}}
|
||||
>
|
||||
모듈 타입별 아이템 목록 조회 API 호출
|
||||
|
||||
@ -26,16 +26,15 @@ export function useMasterController() {
|
||||
|
||||
/**
|
||||
* 모듈 타입별 아이템 목록 조회
|
||||
* @param {지붕재 코드} roofMatlCd
|
||||
* @param {지붕재 코드 목록} arrRoofMatlCd
|
||||
* @returns
|
||||
*/
|
||||
const getModuleTypeItemList = async (roofMatlCd) => {
|
||||
if (!roofMatlCd || roofMatlCd.trim() === '') {
|
||||
const getModuleTypeItemList = async (paramArr) => {
|
||||
if (!Array.isArray(paramArr) || paramArr.length === 0 || paramArr.length > 4 || paramArr.some((item) => !item || item.trim() === '')) {
|
||||
swalFire({ text: getMessage('master.moduletypeitem.message.error'), type: 'alert', icon: 'error' })
|
||||
return null
|
||||
}
|
||||
const param = { roofMatlCd: roofMatlCd }
|
||||
const paramString = getQueryString(param)
|
||||
const paramString = `?${paramArr.map((item) => `arrRoofMatlCd=${item}`).join('&')}`
|
||||
return await get({ url: `/api/v1/master/getModuleTypeItemList${paramString}` }).then((res) => {
|
||||
console.log('🚀🚀 ~ getModuleTypeItemList ~ res:', res)
|
||||
return res
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user