feat(loading-state): add loading indicators and skeleton UI for data tables

- Implement loading state management across patient, doctor and satusehat lists
- Add skeleton loading UI for data tables during data fetching
- Refactor loading state variable naming for consistency
- Make search nav optional in header component
- Update icon sizing in header for better responsiveness
- Implement url search params query state at satusehat
This commit is contained in:
Khafid Prayoga
2025-08-25 13:33:28 +07:00
parent 92d6e2af10
commit 31084be5ce
5 changed files with 139 additions and 124 deletions
+10 -2
View File
@@ -15,6 +15,10 @@ const refSearchNav: RefSearchNav = {
},
}
const isLoading = reactive({
dataListLoading: false,
})
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
@@ -28,13 +32,16 @@ const headerPrep: HeaderPrep = {
},
}
useAsyncData('getDoctor', () => xfetch('/api/v1/doctor'), { server: false, immediate: true })
async function getDoctorList() {
isLoading.dataListLoading = true
const resp = await xfetch('/api/v1/doctor')
if (resp.success) {
data.value = (resp.body as Record<string, any>).data
}
isLoading.dataListLoading = false
}
onMounted(() => {
@@ -44,9 +51,10 @@ onMounted(() => {
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('pull_data', isLoading)
</script>
<template>
<PubNavHeaderPrep :prep="{ ...headerPrep }" :ref-search-nav="refSearchNav" />
<AppDoctorList :data="data" />
<AppDoctorList v-if="!isLoading.dataListLoading" :data="data" />
</template>