import { useParams } from 'common' import { useEffect } from 'react' import { useGitHubAuthorizationCreateMutation } from '@/data/integrations/github-authorization-create-mutation' const GitHubIntegrationAuthorize = () => { const { code, state, setup_action } = useParams() const { mutate, isSuccess, isError, isPending } = useGitHubAuthorizationCreateMutation({ onSuccess() { window.close() }, }) useEffect(() => { if (code && state) { mutate({ code, state }) } else if (setup_action === 'install') { window.close() } }, [code, state, mutate, setup_action]) return (
You can now close this window.
} {isPending &&Authorizing...
} {isError &&Unable to authorize. Please try again.
}