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:
curo1305
2026-06-04 23:15:49 +02:00
co-authored by Claude Sonnet 4.6
parent 7cd29e9454
commit 21366bd288
@@ -84,6 +84,9 @@
</div>
</div>
<!-- Fetch error state -->
<p v-else-if="fetchError" class="text-xs text-red-600 mt-1">{{ fetchError }}</p>
<!-- Empty state -->
<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.
@@ -196,6 +199,7 @@ const total = ref(0)
const page = ref(1)
const perPage = 50
const loading = ref(false)
const fetchError = ref(null)
const exportingCsv = ref(false)
const exportError = ref(null)
@@ -220,6 +224,7 @@ onMounted(() => {
async function fetchLog() {
loading.value = true
fetchError.value = null
try {
const data = await api.adminListAuditLog({
start: filters.start || undefined,
@@ -233,6 +238,7 @@ async function fetchLog() {
total.value = data.total ?? entries.value.length
} catch (e) {
entries.value = []
fetchError.value = 'Failed to load audit log. Please try again.'
} finally {
loading.value = false
}