<template>
  <v-app dark>
    <h1 v-if="error.statusCode !== 404">
      {{ otherError }}
    </h1>
  </v-app>
</template>

<script setup lang="ts">
  import UrlUtils from "~/services/utils/urlUtils";

  const props = defineProps({
    error: {
      type: Object,
      default: null
    }
  })

  if(process.client && props.error.statusCode === 404 && process.env.NODE_ENV === 'production') {
    const runtimeConfig = useRuntimeConfig()
    navigateTo(UrlUtils.join(runtimeConfig.baseUrlAdminLegacy, 'dashboard'), {external: true})
  }

  const otherError = ref('Une erreur est parvenue')
</script>

<style scoped>
h1 {
  font-size: 20px;
}
</style>
