<script setup>
import {onMounted} from "vue";
import {useSystemStore} from "./pinia/SystemStore/index.js";
import {useRoute} from "vue-router";
import {toPath} from "./utils/index.js";

const SystemStore = useSystemStore();
const route = useRoute();

onMounted(() => {
    const isRoot = SystemStore.isRoot;
    if (window.location.href.indexOf('/manage-materials') < 0) {
        SystemStore.clearRouter().then(() => {
            SystemStore.setRouter(isRoot).then(() => {
                toPath(SystemStore.NOW_ROUTER, SystemStore.NOW_ROUTER_QUERY);
            });
        });
    } else {
        toPath('/manage-materials', SystemStore.NOW_ROUTER_QUERY, true);
    }
});
</script>

<template>
    <a-config-provider>
        <router-view></router-view>
    </a-config-provider>
</template>

<style scoped></style>
