@@ -216,9 +216,9 @@ document.addEventListener("DOMContentLoaded", () => {
216216
217217const state = reactive ({
218218 가격: [0 , 10000000 ], // 초기값
219- 면적: [0 , 10000000 ],
220- 사용승인일: [0 , 10000000 ],
221- 층수: [0 , 10000000 ],
219+ 면적: [0 ,200 ],
220+ 사용승인일: [1990 , 2024 ],
221+ 층수: [0 , 40 ],
222222});
223223
224224const isSliderVisible = ref (" " ); // 현재 열려 있는 슬라이더 필터 이름
@@ -228,15 +228,37 @@ const toggleSlider = (filter) => {
228228 // 이미 열려 있는 슬라이더를 클릭하면 닫음
229229 isSliderVisible .value = " " ;
230230 } else {
231- // 다른 슬라이더를 클릭하면 현재 슬라이더를 열고, 나머지는 닫음
232231 isSliderVisible .value = filter;
233232 }
234233};
235234
236- const applyFilter = () => {
235+ const applyFilter = async () => {
236+
237237 for (const [key , value ] of Object .entries (state)) {
238238 console .log (` ${ key} : ${ value[0 ]} ~ ${ value[1 ]} ` );
239239 // console.log(`${value[0]}`)
240+ // 필터링 조건 구성
241+ const filterParams = {// 전달된 param 값
242+ buildingUse,
243+ fromPrice: state[" 가격" ][0 ], // "가격"의 최소값
244+ toPrice: state[" 가격" ][1 ],
245+ fromArea: state[" 면적" ][0 ],
246+ toArea: state[" 면적" ][1 ], // "가격"의 최대값
247+ fromConstructYear: state[' 사용승인일' ][0 ],
248+ toConstructYear: state[' 사용승인일' ][1 ],
249+ fromFloor: state[' 층수' ][0 ],
250+ toFloor: state[' 층수' ][1 ],
251+ };
252+ console .log (" 필터 파라미터:" , filterParams);
253+ // Pinia store의 fetchFilteredHouseInfo 호출
254+ try {
255+ isLoading .value = true ; // 로딩 시작
256+ await houseInfoStore .fetchFilteredHouseInfo (filterParams); // 비동기 작업
257+ isLoading .value = false ; // 로딩 종료
258+ } catch (error) {
259+ console .error (" 필터 적용 중 에러:" , error);
260+ isLoading .value = false ; // 로딩 실패 시에도 종료
261+ }
240262 }
241263};
242264
@@ -344,7 +366,9 @@ const initFilter = () => {
344366 v-model =" state[filter]"
345367 style =" width : 100% "
346368 exponential
347- :max =" 1000000000" >
369+ :max =" 1000000"
370+
371+ >
348372 <template #suffix >만원</template >
349373 </RangeSlider >
350374 <div class =" flex flex-row justify-end" >
0 commit comments