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

<script setup lang="ts">
  import {navigateTo} from "#app";
  import Url from "~/services/utils/url";

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

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

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

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