edit yandex button behavior
This commit is contained in:
@@ -12,6 +12,7 @@ declare global {
|
|||||||
export default function YandexAuthWithScript() {
|
export default function YandexAuthWithScript() {
|
||||||
const buttonRef = useRef<HTMLDivElement>(null);
|
const buttonRef = useRef<HTMLDivElement>(null);
|
||||||
const [isReady, setIsReady] = useState(false);
|
const [isReady, setIsReady] = useState(false);
|
||||||
|
const [showButton, setShowButton] = useState(true);
|
||||||
|
|
||||||
const handleLogin = (token: string) => {
|
const handleLogin = (token: string) => {
|
||||||
console.log('handleLogin');
|
console.log('handleLogin');
|
||||||
@@ -41,6 +42,10 @@ export default function YandexAuthWithScript() {
|
|||||||
console.log(result);
|
console.log(result);
|
||||||
if (result?.access_token) {
|
if (result?.access_token) {
|
||||||
handleLogin(result.access_token);
|
handleLogin(result.access_token);
|
||||||
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
setShowButton(false);
|
||||||
|
}, 1000)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error: any) => {
|
.catch((error: any) => {
|
||||||
@@ -57,6 +62,7 @@ export default function YandexAuthWithScript() {
|
|||||||
onError={() => console.error('Failed to load Yandex script')}
|
onError={() => console.error('Failed to load Yandex script')}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{showButton && (
|
||||||
<div
|
<div
|
||||||
ref={buttonRef}
|
ref={buttonRef}
|
||||||
id="yandex-auth-container"
|
id="yandex-auth-container"
|
||||||
@@ -64,6 +70,7 @@ export default function YandexAuthWithScript() {
|
|||||||
>
|
>
|
||||||
{!isReady && <div>Загрузка Яндекс авторизации...</div>}
|
{!isReady && <div>Загрузка Яндекс авторизации...</div>}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1824,3 +1824,7 @@
|
|||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.yaPreloadingSuggestBlockContainer {
|
||||||
|
height: 52px !important;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user