<script setup lang="ts">
import { onMounted, ref, watch } from 'vue';
import { getInstance } from 'src/services/keycloak';
import useUtilsStore, { dialog, notify } from 'stores/utils';

const utilsStore = useUtilsStore();
const EDM_SERVICE = import.meta.env.VITE_EDM_MICRO_FRONTEND_URL;
const kc = getInstance();
const at = ref(kc.token);
const rt = ref(kc.refreshToken);

onMounted(() => {
  utilsStore.currentTitle.title = 'menu.dms';
  utilsStore.currentTitle.path = [
    {
      text: '',
      i18n: true,
      handler: () => {},
    },
  ];
});

watch(
  () => kc.token,
  () => {
    at.value = kc.token;
    rt.value = kc.refreshToken;
  },
);
</script>

<template>
  <iframe
    :src="`${EDM_SERVICE}/?at=${at}&rt=${rt}`"
    frameborder="0"
    class="full-width full-height rounded"
    allowtransparency="true"
  ></iframe>
</template>

<style scoped></style>
