Files
supabase/apps/studio/pages/integrations/github/authorize.tsx
T
Saxon FletcherandJoshen Lim c76707012d basic typography classes (#37613)
* basic typography classes

* Clean up classes for where we use h1 tags

* Clean up classes for where we use h2, h3, h4

* Clean up classes for where we use h6

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-04 20:55:34 +10:00

35 lines
978 B
TypeScript

import { useEffect } from 'react'
import { useParams } from 'common'
import { useGitHubAuthorizationCreateMutation } from 'data/integrations/github-authorization-create-mutation'
const GitHubIntegrationAuthorize = () => {
const { code, state, setup_action } = useParams()
const { mutate, isSuccess, isError, isLoading } = useGitHubAuthorizationCreateMutation({
onSuccess() {
window.close()
},
})
useEffect(() => {
if (code && state) {
mutate({ code, state })
} else if (setup_action === 'install') {
window.close()
}
}, [code, state, mutate, setup_action])
return (
<div className="h-screen flex flex-col justify-center items-center gap-4">
<h2>Completing GitHub Authorization...</h2>
{isSuccess && <p>You can now close this window.</p>}
{isLoading && <p>Authorizing...</p>}
{isError && <p>Unable to authorize. Please try again.</p>}
</div>
)
}
export default GitHubIntegrationAuthorize