<template>
  <home1 v-if="homeType == 1"></home1>
  <home2 v-else-if="homeType == 2"></home2>
</template>

<script>
  import home1 from "./home1";
  import home2 from "./home2";

  export default {
    data() {
      return {
        homeType: '',
      };
    },
    components: { home1,home2 },
    mounted() {
      let type = '2';
      let roles = this.$store.state.user.roles;
      for (let i = 0; i < roles.length; i++) {
        if (roles[i] == 'leader') {
          type = '1';
        }
      }
      this.homeType = type;
    },
  };
</script>
