<script setup lang="ts">
import { RouterView } from 'vue-router'
import { onMounted, onUnmounted } from 'vue';
import { useRoute } from 'vue-router';
const route = useRoute();

const handleOnlineStatusChange = () => {
  if (navigator.onLine) {
    if (route.name === 'offline') {
      window.location.reload();
    }
  }
};
onMounted(() => {
  window.addEventListener('online', handleOnlineStatusChange);
});
onUnmounted(() => {
  window.removeEventListener('online', handleOnlineStatusChange);
});
</script>

<template>
  <router-view />
</template>

<style scoped>
</style>
