SuperAdmin.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <!--
  2. Super Admin bar : Barre qui s'affiche lorsque l'utilisateur est un super admin en mode switch
  3. -->
  4. <template>
  5. <UiSystemBar color="ot_danger" v-if="show">
  6. <template #bar.text>
  7. <v-icon small>fas fa-exclamation-triangle</v-icon>
  8. <span>{{$t('super_admin_switch_account')}}</span>
  9. <a :href="url" class="ot_black--text text-decoration-none"><strong>{{$t('click_here')}}</strong></a>
  10. </template>
  11. </UiSystemBar>
  12. </template>
  13. <script lang="ts">
  14. import { defineComponent, useStore, useContext} from '@nuxtjs/composition-api'
  15. import {AnyStore} from "~/types/interfaces";
  16. import {State} from "@vuex-orm/core";
  17. export default defineComponent({
  18. setup () {
  19. const {$config} = useContext()
  20. const baseLegacyUrl:string = $config.baseURL_adminLegacy
  21. const store:AnyStore = useStore<State>()
  22. const originalAccess = store.state.profile.access.originalAccess
  23. const url = `${baseLegacyUrl}/switch_user/${originalAccess.organization.id}/${originalAccess.id}/exit`
  24. return {
  25. show: originalAccess.isSuperAdminAccess,
  26. url
  27. }
  28. }
  29. })
  30. </script>
  31. <style scoped>
  32. </style>