Skip to content

Commit

Permalink
chore(core): add oauth connecting state (#6225)
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon authored Mar 23, 2024
1 parent a1532d4 commit 6c9db36
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/frontend/core/src/components/affine/auth/oauth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@affine/core/hooks/affine/use-server-config';
import { OAuthProviderType } from '@affine/graphql';
import { GithubIcon, GoogleDuotoneIcon } from '@blocksuite/icons';
import { type ReactElement, useCallback } from 'react';
import { type ReactElement, useCallback, useState } from 'react';

import { useAuth } from './use-auth';

Expand Down Expand Up @@ -45,8 +45,10 @@ function OAuthProviders() {
function OAuthProvider({ provider }: { provider: OAuthProviderType }) {
const { icon } = OAuthProviderMap[provider];
const { oauthSignIn } = useAuth();
const [isConnecting, setIsConnecting] = useState(false);

const onClick = useCallback(() => {
setIsConnecting(true);
oauthSignIn(provider);
}, [provider, oauthSignIn]);

Expand All @@ -61,6 +63,7 @@ function OAuthProvider({ provider }: { provider: OAuthProviderType }) {
onClick={onClick}
>
Continue with {provider}
{isConnecting && '...'}
</Button>
);
}

0 comments on commit 6c9db36

Please sign in to comment.