43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
import { createApp } from 'vue'
|
|
import App from './App.vue'
|
|
import './style.css'
|
|
import { VueTelegramPlugin } from 'vue-tg';
|
|
import { router } from './router';
|
|
import { createPinia } from 'pinia';
|
|
|
|
const config = {
|
|
night_auto: true,
|
|
theme: {
|
|
light: 'light',
|
|
dark: 'dark',
|
|
}
|
|
};
|
|
|
|
const pinia = createPinia();
|
|
const app = createApp(App);
|
|
app
|
|
.use(pinia)
|
|
.use(router)
|
|
.use(VueTelegramPlugin);
|
|
|
|
app.mount('#app');
|
|
|
|
const productsStore = useProductsStore();
|
|
productsStore.fetchHomeProducts();
|
|
const categoriesStore = useCategoriesStore();
|
|
categoriesStore.fetchTopCategories();
|
|
|
|
import {useProductsStore} from "@/stores/ProductsStore.js";
|
|
import {useCategoriesStore} from "@/stores/CategoriesStore.js";
|
|
|
|
if (config.night_auto) {
|
|
window.Telegram.WebApp.onEvent('themeChanged', function () {
|
|
document.documentElement.setAttribute('data-theme', config.theme[this.colorScheme]);
|
|
});
|
|
} else {
|
|
document.documentElement.setAttribute('data-theme', config.theme.light);
|
|
}
|
|
|
|
window.Telegram.WebApp.ready();
|
|
|