refactor: 모듈 타입별 아이템 목록 조회 api의 req param을 배열로 변경

This commit is contained in:
Daseul Kim 2024-12-23 17:15:18 +09:00
parent d6b4a03293
commit 371f1eb202
2 changed files with 5 additions and 6 deletions

View File

@ -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 호출

View File

@ -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