Web: Login: fix oAuth, modified types

This commit is contained in:
Artem Tarasov 2022-08-25 18:13:46 +03:00
parent 7735e0b0a3
commit 2f70694632
3 changed files with 19 additions and 6 deletions

View File

@ -104,4 +104,8 @@ declare global {
[Login: string]: { [key: any]: string };
};
}
type HTMLElementEvent<T extends HTMLElement> = Event & {
target: T;
};
}

View File

@ -77,12 +77,19 @@ const Login: React.FC<ILoginProps> = ({
};
const onSocialButtonClick = useCallback(
(e: React.SyntheticEvent<EventTarget>) => {
if (!(e.target instanceof HTMLButtonElement)) {
return;
(e: HTMLElementEvent<HTMLButtonElement | HTMLElement>) => {
const { target } = e;
let targetElement = target;
if (
!(targetElement instanceof HTMLButtonElement) &&
target.parentElement
) {
targetElement = target.parentElement;
console.log(targetElement);
}
const providerName = e.target.dataset.providername;
const url = e.target.dataset.url || "";
const providerName = targetElement.dataset.providername;
const url = targetElement.dataset.url || "";
try {
const tokenGetterWin = isDesktopEditor

View File

@ -51,7 +51,9 @@ interface IMoreLoginNodalProps {
visible: boolean;
onClose: VoidFunction;
providers: ProvidersType;
onSocialLoginClick: (e: React.SyntheticEvent<EventTarget>) => void;
onSocialLoginClick: (
e: HTMLElementEvent<HTMLButtonElement | HTMLElement>
) => void;
ssoLabel: string;
ssoUrl: string;
}