import './assets/main.css'

import { createApp } from 'vue'
import pinia from './stores'

import App from './App.vue'
import router from './router'
import WriteLogo from './components/writeLogo.vue'
import { Icon } from '@iconify/vue'

const app = createApp(App)

// Регистрируем компоненты глобально
app.component('WriteLogo', WriteLogo)
// eslint-disable-next-line vue/multi-word-component-names
app.component('Icon', Icon)

app.use(pinia)
app.use(router)

// Инициализация auth store после создания app
import { useAuthStore } from './stores/auth'
const authStore = useAuthStore()
// Инициализируем авторизацию
authStore.initializeAuth().then(() => {
  console.log('Auth initialization completed')
}).catch(error => {
  console.error('Auth initialization failed:', error)
})

app.mount('#app')
