fix(06): WR-09 show error message when audit log fetch fails
Add fetchError ref initialized to null. Clear it at the start of fetchLog() and set it on catch. Add <p v-else-if="fetchError"> block in template between loading and empty states so admin users see "Failed to load audit log. Please try again." instead of the empty-state message when an API error occurs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
7cd29e9454
commit
21366bd288
@@ -84,6 +84,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Fetch error state -->
|
||||||
|
<p v-else-if="fetchError" class="text-xs text-red-600 mt-1">{{ fetchError }}</p>
|
||||||
|
|
||||||
<!-- Empty state -->
|
<!-- Empty state -->
|
||||||
<div v-else-if="entries.length === 0" class="text-center py-12 text-gray-400 text-sm">
|
<div v-else-if="entries.length === 0" class="text-center py-12 text-gray-400 text-sm">
|
||||||
No audit log entries match the selected filters.
|
No audit log entries match the selected filters.
|
||||||
@@ -196,6 +199,7 @@ const total = ref(0)
|
|||||||
const page = ref(1)
|
const page = ref(1)
|
||||||
const perPage = 50
|
const perPage = 50
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
const fetchError = ref(null)
|
||||||
const exportingCsv = ref(false)
|
const exportingCsv = ref(false)
|
||||||
const exportError = ref(null)
|
const exportError = ref(null)
|
||||||
|
|
||||||
@@ -220,6 +224,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
async function fetchLog() {
|
async function fetchLog() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
fetchError.value = null
|
||||||
try {
|
try {
|
||||||
const data = await api.adminListAuditLog({
|
const data = await api.adminListAuditLog({
|
||||||
start: filters.start || undefined,
|
start: filters.start || undefined,
|
||||||
@@ -233,6 +238,7 @@ async function fetchLog() {
|
|||||||
total.value = data.total ?? entries.value.length
|
total.value = data.total ?? entries.value.length
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
entries.value = []
|
entries.value = []
|
||||||
|
fetchError.value = 'Failed to load audit log. Please try again.'
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user