import type { Hero } from "~~/types/hero";

export default defineNuxtPlugin(async () => {


    const { useHeroStore } = await import('@/stores/hero')
    const heroStore = useHeroStore()

    const config = useRuntimeConfig();
    const apiUrl = config.public.BASE_API_URL;

    try {
        const data = await $fetch<Hero>(`${apiUrl}/api/v1/hero`)
        if (data) {
            heroStore.setHero(data)
        }
    } catch (error) {
        console.error('Failed to fetch settings:', error)
    }
})
