trypost/resources/js/components/AlertError.vue

32 lines
840 B
Vue
Raw Normal View History

2026-01-15 01:13:44 +00:00
<script setup lang="ts">
2026-01-21 21:42:37 +00:00
import { IconAlertCircle } from '@tabler/icons-vue';
2026-01-15 01:13:44 +00:00
import { computed } from 'vue';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
interface Props {
errors: string[];
title?: string;
}
const props = withDefaults(defineProps<Props>(), {
title: 'Something went wrong.',
});
const uniqueErrors = computed(() => Array.from(new Set(props.errors)));
</script>
<template>
<Alert variant="destructive">
2026-01-21 21:42:37 +00:00
<IconAlertCircle class="size-4" />
2026-01-15 01:13:44 +00:00
<AlertTitle>{{ title }}</AlertTitle>
<AlertDescription>
<ul class="list-inside list-disc text-sm">
<li v-for="(error, index) in uniqueErrors" :key="index">
{{ error }}
</li>
</ul>
</AlertDescription>
</Alert>
</template>