Skip to content

Commit

Permalink
skip call API if yyyymm=null
Browse files Browse the repository at this point in the history
  • Loading branch information
azuki774 committed Mar 1, 2025
1 parent 8250019 commit d47746c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion components/SearchHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,19 @@ onMounted(async () => {
const fetchData = async (yyyymm: string, categoryID: string) => {
try {
let query = `?yyyymm=${yyyymm}`
if (yyyymm == null) {
// パラメータが不正なときは何もしない
return
}
let query = `?yyyymm=${yyyymm}`
// categoryID が null または undefined の場合、'-1' に置き換える
const validCategoryID = categoryID ? categoryID : '-1'
if (validCategoryID == '-1') {
// パラメータが不正なときは何もしない
return
}
if (categoryID != '0') {
// 0 = 全カテゴリ
query += `&category_id=${validCategoryID}`
Expand Down

0 comments on commit d47746c

Please sign in to comment.