🔧 chore: add toast
This commit is contained in:
parent
3b67396c43
commit
89306ddcc7
@ -10,6 +10,7 @@ import {
|
|||||||
GithubIcon,
|
GithubIcon,
|
||||||
GitTeaIcon,
|
GitTeaIcon,
|
||||||
} from 'components/shared/CustomIcon';
|
} from 'components/shared/CustomIcon';
|
||||||
|
import { useToast } from 'components/shared/Toast';
|
||||||
|
|
||||||
const SCOPES = 'repo user';
|
const SCOPES = 'repo user';
|
||||||
const GITHUB_OAUTH_URL = `https://github.com/login/oauth/authorize?client_id=${
|
const GITHUB_OAUTH_URL = `https://github.com/login/oauth/authorize?client_id=${
|
||||||
@ -25,12 +26,20 @@ const ConnectAccount: React.FC<ConnectAccountInterface> = ({
|
|||||||
}: ConnectAccountInterface) => {
|
}: ConnectAccountInterface) => {
|
||||||
const client = useGQLClient();
|
const client = useGQLClient();
|
||||||
|
|
||||||
|
const { toast, dismiss } = useToast();
|
||||||
|
|
||||||
const handleCode = async (code: string) => {
|
const handleCode = async (code: string) => {
|
||||||
// Pass code to backend and get access token
|
// Pass code to backend and get access token
|
||||||
const {
|
const {
|
||||||
authenticateGitHub: { token },
|
authenticateGitHub: { token },
|
||||||
} = await client.authenticateGitHub(code);
|
} = await client.authenticateGitHub(code);
|
||||||
onToken(token);
|
onToken(token);
|
||||||
|
toast({
|
||||||
|
onDismiss: dismiss,
|
||||||
|
id: 'connected-to-github',
|
||||||
|
title: 'The Git account is connected.',
|
||||||
|
variant: 'success',
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Use correct height
|
// TODO: Use correct height
|
||||||
|
Loading…
Reference in New Issue
Block a user