refactor(composables): update API query params and improve code style

- Standardize parameter naming with hyphens instead of underscores
- Remove page size limit and enable no-limit flag for all region queries
- Improve arrow function syntax consistency and formatting
This commit is contained in:
Khafid Prayoga
2025-10-09 10:13:00 +07:00
parent 3ffc28fdeb
commit 1f93fc2c81
4 changed files with 12 additions and 14 deletions

No files matched your search

+6 -8
View File
@@ -13,11 +13,11 @@ const error = ref<string | null>(null)
export function useProvinces() {
// Computed untuk format SelectItem
const provinceOptions = computed<SelectItem[]>(() => {
return provincesCache.value.map(province => ({
return provincesCache.value.map((province) => ({
label: toTitleCase(province.name),
value: province.code,
// code: province.code,
searchValue: `${province.code} ${province.name}`.trim() // Untuk search internal combobox
searchValue: `${province.code} ${province.name}`.trim(), // Untuk search internal combobox
}))
})
@@ -38,8 +38,8 @@ export function useProvinces() {
try {
const response = await provinceService.getList({
'page-no-limit': '1',
'sort': 'name:asc'
'page-no-limit': true,
sort: 'name:asc',
})
if (response.success) {
@@ -59,14 +59,12 @@ export function useProvinces() {
// Function untuk mencari province berdasarkan code
function getProvinceByCode(code: string): Province | undefined {
return provincesCache.value.find(province => province.code === code)
return provincesCache.value.find((province) => province.code === code)
}
// Function untuk mencari province berdasarkan name
function getProvinceByName(name: string): Province | undefined {
return provincesCache.value.find(province =>
province.name.toLowerCase() === name.toLowerCase()
)
return provincesCache.value.find((province) => province.name.toLowerCase() === name.toLowerCase())
}
// Function untuk clear cache (jika diperlukan)