chore(core): add oauth connecting state (#6225)
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
|||||||
} from '@affine/core/hooks/affine/use-server-config';
|
} from '@affine/core/hooks/affine/use-server-config';
|
||||||
import { OAuthProviderType } from '@affine/graphql';
|
import { OAuthProviderType } from '@affine/graphql';
|
||||||
import { GithubIcon, GoogleDuotoneIcon } from '@blocksuite/icons';
|
import { GithubIcon, GoogleDuotoneIcon } from '@blocksuite/icons';
|
||||||
import { type ReactElement, useCallback } from 'react';
|
import { type ReactElement, useCallback, useState } from 'react';
|
||||||
|
|
||||||
import { useAuth } from './use-auth';
|
import { useAuth } from './use-auth';
|
||||||
|
|
||||||
@@ -45,8 +45,10 @@ function OAuthProviders() {
|
|||||||
function OAuthProvider({ provider }: { provider: OAuthProviderType }) {
|
function OAuthProvider({ provider }: { provider: OAuthProviderType }) {
|
||||||
const { icon } = OAuthProviderMap[provider];
|
const { icon } = OAuthProviderMap[provider];
|
||||||
const { oauthSignIn } = useAuth();
|
const { oauthSignIn } = useAuth();
|
||||||
|
const [isConnecting, setIsConnecting] = useState(false);
|
||||||
|
|
||||||
const onClick = useCallback(() => {
|
const onClick = useCallback(() => {
|
||||||
|
setIsConnecting(true);
|
||||||
oauthSignIn(provider);
|
oauthSignIn(provider);
|
||||||
}, [provider, oauthSignIn]);
|
}, [provider, oauthSignIn]);
|
||||||
|
|
||||||
@@ -61,6 +63,7 @@ function OAuthProvider({ provider }: { provider: OAuthProviderType }) {
|
|||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
Continue with {provider}
|
Continue with {provider}
|
||||||
|
{isConnecting && '...'}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user