From 77f00597eeb6c59d4e6ef2e56d045e502526f41a Mon Sep 17 00:00:00 2001 From: Vladimir Voronin Date: Mon, 4 Nov 2024 17:59:42 +0300 Subject: [PATCH] fixes --- src/App.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index 5c6d55e..e744a86 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,6 +7,7 @@
+ {{ tg_id }}
@@ -24,9 +25,19 @@ import {subscribeUserToPush} from "@/services/pushManager"; import apiClient from '@/services/axiosSetup'; const checkNotif = computed(() => { - return 'Notification' in window && Notification.permission === 'default' + + return !!tg_id.value && 'Notification' in window && Notification.permission === 'default' }) +const tg_id = computed(() => { + if (window.Telegram?.WebApp) { + const tg = window.Telegram.WebApp; + tg.expand(); // Разворачиваем приложение на весь экран + return tg.initDataUnsafe.user?.id ?? null; // Если tg_id нет, возвращаем null + } + return null; +}); + const checkSubscribe = async () => { if ("Notification" in window) { if (Notification.permission === 'default') {