mirror of
https://github.com/pezkuwichain/pezkuwi-telegram-miniapp.git
synced 2026-04-30 02:38:05 +00:00
debug: add retry auth button and increase wait time to 5s
This commit is contained in:
@@ -22,7 +22,8 @@ interface AuthContextType {
|
||||
const AuthContext = createContext<AuthContextType | null>(null);
|
||||
|
||||
// Wait for Telegram SDK to be ready with initData
|
||||
function waitForInitData(maxAttempts = 10, intervalMs = 200): Promise<string | null> {
|
||||
// 25 attempts * 200ms = 5 seconds max wait
|
||||
function waitForInitData(maxAttempts = 25, intervalMs = 200): Promise<string | null> {
|
||||
return new Promise((resolve) => {
|
||||
let attempts = 0;
|
||||
|
||||
|
||||
@@ -14,7 +14,14 @@ import { useAuth } from '@/contexts/AuthContext';
|
||||
|
||||
export function AnnouncementsSection() {
|
||||
const { hapticImpact, hapticNotification, openLink } = useTelegram();
|
||||
const { isAuthenticated, sessionToken, user, authError } = useAuth();
|
||||
const {
|
||||
isAuthenticated,
|
||||
sessionToken,
|
||||
user,
|
||||
authError,
|
||||
signIn,
|
||||
isLoading: authLoading,
|
||||
} = useAuth();
|
||||
|
||||
const { data: announcements, isLoading, refetch, isRefetching } = useAnnouncements();
|
||||
const reactionMutation = useAnnouncementReaction(sessionToken);
|
||||
@@ -91,6 +98,15 @@ export function AnnouncementsSection() {
|
||||
Platform: {window.Telegram?.WebApp?.platform || 'unknown'} | Ver:{' '}
|
||||
{window.Telegram?.WebApp?.version || '?'}
|
||||
</div>
|
||||
{!isAuthenticated && (
|
||||
<button
|
||||
onClick={() => signIn()}
|
||||
disabled={authLoading}
|
||||
className="mt-2 px-3 py-1 bg-yellow-500 text-black rounded text-xs font-medium"
|
||||
>
|
||||
{authLoading ? 'Deneniyor...' : 'Retry Auth'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Content */}
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "1.0.148",
|
||||
"buildTime": "2026-02-07T02:35:20.304Z",
|
||||
"buildNumber": 1770431720305
|
||||
"version": "1.0.149",
|
||||
"buildTime": "2026-02-07T02:40:20.478Z",
|
||||
"buildNumber": 1770432020479
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user