<script setup lang="ts">
import { fr } from "@nuxt/ui/locale";

import type { NuxtError } from "#app";

const props = defineProps<{ error: NuxtError }>();

const sanitizedError = computed<NuxtError>(() => {
  const error = props.error;
  switch (error.status) {
    case 404:
      error.statusMessage = "Page non trouvée";
      break;
    case 500:
      error.statusMessage = "Erreur interne du serveur";
      break;
  }
  return error;
});
</script>

<template>
  <UApp :locale="fr">
    <UError :error="sanitizedError" />
  </UApp>
</template>
