fix .env.production

This commit is contained in:
xds
2025-10-31 16:37:01 +03:00
parent 5d756da232
commit 5b105b42ee
2 changed files with 32 additions and 0 deletions

View File

@@ -17,7 +17,29 @@ const password = ref<string>('')
const userStore = useUserStore()
const telegramBtn = ref(null)
function onTelegramAuth(user) {
console.log('TG login success', user)
alert(`Logged in as ${user.first_name} (@${user.username})`)
// 👉 здесь отправляешь user.auth_data на бэк для проверки Telegram-sign
}
onMounted(() => {
// передаём функцию глобально чтобы виджет её увидел
window.onTelegramAuth = onTelegramAuth
const script = document.createElement("script")
script.src = "https://telegram.org/js/telegram-widget.js?22"
script.setAttribute("data-telegram-login", "luminicspacebot") // ← твой bot
script.setAttribute("data-size", "large")
script.setAttribute("data-onauth", "onTelegramAuth(user)")
script.setAttribute("data-request-access", "write")
script.async = true
telegramBtn.value.appendChild(script)
// сообщаем Telegram WebApp, что UI готов
if (tgApp.initData) {
tgData.value = tgApp.initDataUnsafe
@@ -33,6 +55,9 @@ onMounted(() => {
</script>
<template>
<div class="login">
<div ref="telegramBtn"></div>
</div>
<div class="flex !w-full items-center justify-center h-100">
<div class="card !w-fit">