This commit is contained in:
xds
2026-03-16 12:43:13 +03:00
parent ad677a1039
commit c558117d7e

View File

@@ -7,6 +7,7 @@ import ProgressSpinner from 'primevue/progressspinner'
const auth = useAuthStore()
const loading = ref(false)
const error = ref('')
const botUserName = import.meta.env.VITE_TELEGRAM_BOT_USERNAME
// Telegram Login Widget callback — must be global
;(window as any).onTelegramAuth = async (user: TelegramLoginData) => {
@@ -21,6 +22,7 @@ const error = ref('')
}
onMounted(async () => {
console.log(botUserName)
// Check if running inside Telegram WebApp
const webapp = window.Telegram?.WebApp
if (webapp?.initData) {
@@ -41,7 +43,8 @@ onMounted(async () => {
if (container) {
const script = document.createElement('script')
script.src = 'https://telegram.org/js/telegram-widget.js?22'
script.setAttribute('data-telegram-login', import.meta.env.VITE_TELEGRAM_BOT_USERNAME || '')
console.log()
script.setAttribute('data-telegram-login', botUserName || '')
script.setAttribute('data-size', 'large')
script.setAttribute('data-radius', '8')
script.setAttribute('data-onauth', 'onTelegramAuth(user)')