fix
This commit is contained in:
@@ -1,18 +1,35 @@
|
||||
|
||||
import {Cookie} from "./tg_app/Cookie.js";
|
||||
import {TgApp} from "./tg_app/TgApp.js";
|
||||
import Router from "./tg_app/Router.js";
|
||||
import {SimpleRouter} from "./tg_app/SimpleRouter.js";
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
let tg = window.Telegram.WebApp;
|
||||
let tgApp = new TgApp("tg_app", tg.initDataUnsafe.user.id);
|
||||
|
||||
const router = new Router({
|
||||
mode: 'hash',
|
||||
root: '/miniapp'
|
||||
});
|
||||
// const router = new Router({
|
||||
// mode: 'hash',
|
||||
// root: '/miniapp'
|
||||
// });
|
||||
|
||||
router
|
||||
.add('', () => {
|
||||
const cookie = new Cookie();
|
||||
const routes = {
|
||||
'/miniapp': () => {
|
||||
cookie.setCookie("dialog_id", tg.initDataUnsafe.user.id, 3)
|
||||
tgApp.actionMain();
|
||||
});
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
// Инициализация роутера
|
||||
const router = new SimpleRouter(routes);
|
||||
|
||||
// const router
|
||||
// .add('/', () => {
|
||||
// cookie.setCookie("dialog_id", tg.initDataUnsafe.user.id, 3)
|
||||
// tgApp.actionMain();
|
||||
// })
|
||||
// .add('/scanner', () => {
|
||||
// tgApp.createScanner();
|
||||
// });
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user