feat(apps/web): update user photo on app launch

This commit is contained in:
vchikalkin 2025-01-12 18:18:02 +03:00
parent f1f1ac3183
commit 56a299c656

View File

@ -1,4 +1,5 @@
'use client';
import { updateProfile } from '@/actions/profile';
import { LoadingSpinner } from '@repo/ui/components/ui/spinner';
import { initData, isMiniAppDark, useSignal } from '@telegram-apps/sdk-react';
import { signIn, useSession } from 'next-auth/react';
@ -15,6 +16,8 @@ export default function Auth() {
useEffect(() => {
setTheme(isDark ? 'dark' : 'light');
if (initDataUser?.photoUrl) updateProfile({ photoUrl: initDataUser?.photoUrl });
if (status === 'authenticated') {
redirect('/profile');
}