import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import router from './router'
import unifiedLoginSDK from "oauth2-login-sdk";

// SDK配置
const SDK_CONFIG = {
    clientId: 'b55c88c20db94790a60a5075',
    registrationId: 'demo',
    storageType: 'localStorage' as const,
    basepath: '/demo-api',
    idpLogoutUrl: 'http://106.14.217.120/idp-ui/logout',
    homePage: 'http://106.14.217.120/demo/dashboard'
};

// 初始化SDK
try {
    unifiedLoginSDK.init(SDK_CONFIG);
    console.log('✅ SDK初始化成功');
} catch (error) {
    console.error('❌ SDK初始化失败:', error);
}

// 创建Vue应用
const app = createApp(App)

// 注册路由
app.use(router)

// 挂载应用
app.mount('#app')

// 全局错误处理
app.config.errorHandler = (err, _instance, info) => {
    console.error('Vue错误:', err, info);
};
