<template>
  <Message v-if="props.errors" severity="error">
    <template v-if="props.errors instanceof Array">
      <div v-for="error of props.errors">
        {{ error }}
      </div>
    </template>
    <template v-else>
      <div v-for="(errs, key) in props.errors">
        {{ key }}:
        <template v-if="errs instanceof Array">
          <div v-for="error of errs">
            {{ error }}
          </div>
        </template>
        <template v-else>
          {{ errs }}
        </template>
      </div>
    </template>
  </Message>
</template>

<script setup lang="ts">
import Message from "primevue/message";
const props = defineProps<{
  errors?: Record<string, string[]> | string[];
}>();
</script>

<style scoped></style>
