<script>
export default {
  mounted() {
    this.jump();

    setTimeout(() => {
      if (this.$route.path.startsWith("/redirect")) this.jump();
    });
  },
  methods: {
    jump() {
      const { params, query, path } = this.$route;
      const { pathMatch } = params;
      const toPath = path.substr(9);
      if (pathMatch) {
        this.$router.push({
          path: pathMatch,
          query,
          replace: true,
        });
      } else if (toPath) {
        this.$router.push({
          path: pathMatch,
          query,
          replace: true,
        });
      }
    },
  },
  render(h) {
    return h(); // avoid warning message
  },
};
</script>
