Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] 빈 문자열 검색 불가 #273

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Loading