<template>
  <div class="mx-auto max-w-xl">
    <iframe class="frame" :src="url" frameborder="0"></iframe>
  </div>
</template>

<script setup lang="ts">
import { getCustomerService } from '@/api/service'
import { onMounted, ref } from 'vue';
import * as AuthUtils from '@/utils/auth'

const service = ref({})
const loading = ref(true)

const url = ref(localStorage.getItem("chaturl"))


const getServiceList = async () => {
  loading.value = true
  try {
    service.value = await getCustomerService()

    url.value = service.value.link + '?t=' + AuthUtils.getAccessToken() + '&r=' + AuthUtils.getRefreshToken()
  } finally {
    loading.value = false
  }
}
getServiceList()

onMounted(async () => {
  // await getServiceList()
})

</script>

<style scoped>
.frame {
  width: 100%;
  height: calc(100vh - 4rem);
}
</style>