import { BaseForm } from './base-form';
import { useLogin, useTelegramConfirm, useTelegramLogin } from './hooks/telegram';
import { useRefreshToken } from './hooks/token';
import { ButtonLoading, ButtonLogin, ButtonTelegram, ButtonTelegramLogin } from './lib/buttons';
import { FormStateContext } from '@/context/form-state';
import { useContext } from 'react';
export function TelegramForm() {
useRefreshToken();
const { handleLogin } = useLogin();
const { handleTelegramLogin } = useTelegramLogin();
useTelegramConfirm();
const {
state: { step },
} = useContext(FormStateContext);
if (step === 'refresh-token') {
return Подождите...;
}
if (step === 'login-success') {
return (
handleTelegramLogin()}>
Войти через Telegram
);
}
if (step === 'telegram-notification') {
return (
{}}>
Ожидаем подтверждения...
);
}
return (
handleLogin(data)}>
Далее
);
}