/** 用于刷新路由 license by http://eleadmin.com */
import {createVNode, defineComponent, unref} from 'vue';
import {useRouter} from 'vue-router';
import {useStore} from 'vuex';

export default defineComponent({
  name: 'EleRedirect',
  setup() {
    const {currentRoute, replace} = useRouter();
    const {dispatch} = useStore();
    const {params, query} = unref(currentRoute);
    const {path} = params;
    const _path = Array.isArray(path) ? path.join('/') : path;
    dispatch('theme/setKeepAliveExclude', []).then(() => {
      replace({
        path: '/' + _path,
        query: query,
      }).then(() => {
      });
    });
    return {};
  },
  render() {
    return createVNode('div');
  }
});
