2023-03-03 15:54:28 +00:00
|
|
|
<script setup>
|
|
|
|
import { computed, defineProps } from 'vue';
|
|
|
|
import { usePage } from '@inertiajs/vue3';
|
|
|
|
import NotificationBarInCard from '@/Components/NotificationBarInCard.vue';
|
|
|
|
|
|
|
|
// const errors = computed(() => usePage().props.errors);
|
|
|
|
// const hasErrors = computed(() => Object.keys(props.errors.value).length > 0);
|
|
|
|
|
|
|
|
const props = defineProps({
|
2023-10-31 14:38:43 +00:00
|
|
|
errors: Object,
|
2023-03-03 15:54:28 +00:00
|
|
|
});
|
2023-10-31 14:38:43 +00:00
|
|
|
const hasErrors = computed(() => {
|
|
|
|
return props.errors != null && Object.keys(props.errors).length > 0;
|
2023-03-03 15:54:28 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-10-31 14:38:43 +00:00
|
|
|
<NotificationBarInCard v-if="hasErrors" color="danger">
|
|
|
|
<b>Whoops! Something went wrong.</b>
|
|
|
|
<span v-for="(error, key) in errors" :key="key">{{ error }}</span>
|
|
|
|
</NotificationBarInCard>
|
2023-03-03 15:54:28 +00:00
|
|
|
</template>
|