<script setup lang="ts">
import WujieVueRendererAdapter from '@sy/wujie-vue3-renderer-adapter';
import axios from 'axios';

import { useUserStore } from '#/store/user';

const props = defineProps<{
  [key: string]: any;
  fileId: string;
  projectId: number;
}>();

const userStore = useUserStore();

const instance = axios.create({});

instance.interceptors.request.use(
  (config) => {
    config.headers.Authorization = `Bearer ${userStore.token}`;
    return config;
  },
  (error) => Promise.reject(error),
);
</script>

<template>
  <WujieVueRendererAdapter
    v-bind="props"
    :interceptors="instance.interceptors"
  />
</template>
