import { createApp } from 'vue';
import App from './App.vue';
import { useToasts } from './composables/useToasts';

/*
 * Marriage Expense Tracker — Vue 3 single-page app.
 *
 * The Blade shell (resources/views/app.blade.php) ships the static config in
 * window.__TRACKER__ and nothing else; every expense is read and written over
 * /api/expenses, and every outcome is reported by a toast.
 */
const app = createApp(App);

// A crash inside a component must not leave the user staring at a frozen page.
app.config.errorHandler = (error) => {
    console.error(error);
    useToasts().error('অ্যাপে সমস্যা হয়েছে। পেজটি রিফ্রেশ করুন।');
};

app.mount('#app');
