<template>
  <div class="dashboard-container">
    <component :is="currentRole" />
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import adminDashboard from './admin'
import runnerDashboard from './runner'

export default {
  name: 'Dashboard',
  components: { adminDashboard, runnerDashboard },
  data() {
    return {
      currentRole: 'adminDashboard'
    }
  },
  computed: {
    ...mapGetters(['roles'])
  },
  created() {
    if (this.roles.includes('admin')) {
      this.$notify({
        title: '----admin---',
        message: 'adminadminadminadmin',
        type: 'success',
        duration: 2000
      })
      this.currentRole = 'adminDashboard'
    }
    if (this.roles.includes('assistant')) {
      this.$notify({
        title: '----assistant---',
        message: 'assistantassistantassistantassistant',
        type: 'success',
        duration: 2000
      })
      this.currentRole = 'adminDashboard'
    }
    if (this.roles.includes('runner')) {
      this.$notify({
        title: '----runner---',
        message: 'runnerrunnerrunnerrunner',
        type: 'success',
        duration: 2000
      })
      this.currentRole = 'runnerDashboard'
    }
    if (this.roles.includes('shoper')) {
      this.$notify({
        title: '----shoper---',
        message: 'shopershopershopershoper',
        type: 'success',
        duration: 2000
      })
      this.currentRole = 'runnerDashboard'
    }
  }
}
</script>
