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