Skip to content

Commit

Permalink
Merge pull request #273 from lotteon2/develop
Browse files Browse the repository at this point in the history
[FIX] 빈 문자열 검색 불가
  • Loading branch information
CokeLee777 authored Jan 28, 2024
2 parents 4c0118a + e51b90f commit 3bce2c9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/components/HeaderComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const memberId = computed(() => memberInfo.value.memberId)
const searchQuery = ref<string | null>(null)
const routeSearch = () => {
if (searchQuery.value === null) {
if (searchQuery.value === null || searchQuery.value.trim().length === 0) {
infoModal('알림', '검색 키워드를 입력해주세요.')
} else {
window.location.href = `/product-search?query=${searchQuery.value}`
Expand Down Expand Up @@ -274,4 +274,4 @@ onMounted(async () => {

<style scoped>
@import '@/assets/header.css';
</style>
</style>
37 changes: 17 additions & 20 deletions src/views/ProductListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ const initData = async () => {
onBeforeMount(initData)
const scrollToTop = () => {
alert('to top')
window.scrollTo({ top: 0, behavior: 'smooth' })
}
const changeBrand = (idx: number) => {
// 한 번 누른거 또 누르면 브랜드 선택 해제
if (brandId.value === brandStore.brandList[idx].id) {
Expand All @@ -84,21 +79,23 @@ const changeGender = (genderVal: string) => {
// 검색 버튼 클릭 시 다시 조회
const changeQuery = async () => {
const response: ReadProductSliceResponse = await getProductSlice(
brandId.value,
categoryId.value,
gender.value,
lowPrice.value,
highPrice.value,
query.value,
(page.value = 0),
sort.value,
direction.value
)
if (query.value !== null && query.value.trim().length !== 0) {
const response: ReadProductSliceResponse = await getProductSlice(
brandId.value,
categoryId.value,
gender.value,
lowPrice.value,
highPrice.value,
query.value,
(page.value = 0),
sort.value,
direction.value
)
page.value++
hasNext.value = response.hasNext
products.value = response.productResponses
page.value++
hasNext.value = response.hasNext
products.value = response.productResponses
}
}
// 정렬 기준 변경 시 다시 조회
Expand Down Expand Up @@ -639,4 +636,4 @@ const getProductMaxDiscountPercentage = (product: ReadProductResponse) => {
width: 10vw;
height: 19.5vh;
}
</style>
</style>

0 comments on commit 3bce2c9

Please sign in to comment.