Skip to content

Commit 5949430

Browse files
Merge pull request #3983 from RedisInsight/fe/bugfix/RI-6225-social-button-fix
RI-6225 social button fix
2 parents fb4d5d4 + 55dca6a commit 5949430

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

redisinsight/ui/src/components/oauth/shared/oauth-form/OAuthForm.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ const OAuthForm = ({
2525
const dispatch = useDispatch()
2626

2727
const [authStrategy, setAuthStrategy] = useState('')
28+
const [disabled, setDisabled] = useState(false)
2829

2930
const initOAuthProcess = (strategy: OAuthStrategy, action: string, data?: {}) => {
3031
dispatch(signIn())
3132
ipcAuth(strategy, action, data)
3233
}
3334

3435
const onSocialButtonClick = (authStrategy: OAuthStrategy) => {
36+
setDisabled(true)
37+
setTimeout(() => { setDisabled(false) }, 1000)
3538
dispatch(enableUserAnalyticsAction())
3639
setAuthStrategy(authStrategy)
3740
onClick?.(authStrategy)
@@ -83,6 +86,7 @@ const OAuthForm = ({
8386
<OAuthSocialButtons
8487
onClick={onSocialButtonClick}
8588
{...rest}
89+
disabled={disabled}
8690
/>
8791
)
8892
)

redisinsight/ui/src/components/oauth/shared/oauth-social-buttons/OAuthSocialButtons.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react'
1+
import React, { useState } from 'react'
22
import { EuiButtonEmpty, EuiIcon, EuiText, EuiToolTip } from '@elastic/eui'
33
import cx from 'classnames'
44
import { useSelector } from 'react-redux'
@@ -15,10 +15,11 @@ export interface Props {
1515
onClick: (authStrategy: OAuthStrategy) => void
1616
className?: string
1717
inline?: boolean
18+
disabled?: boolean
1819
}
1920

2021
const OAuthSocialButtons = (props: Props) => {
21-
const { onClick, className, inline } = props
22+
const { onClick, className, inline, disabled } = props
2223

2324
const agreement = useSelector(oauthCloudPAgreementSelector)
2425

@@ -58,7 +59,7 @@ const OAuthSocialButtons = (props: Props) => {
5859
>
5960
<>
6061
<EuiButtonEmpty
61-
disabled={!agreement}
62+
disabled={!agreement || disabled}
6263
className={cx(styles.button, className, { [styles.inline]: inline })}
6364
onClick={() => {
6465
onClick(strategy)

0 commit comments

Comments
 (0)