Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: add loading indicator to `Sign in with Github` button

Stojan Dimitrovski8d332e49375c
diff --git a/studio/components/interfaces/SignIn/SignInWithGitHub.tsx b/studio/components/interfaces/SignIn/SignInWithGitHub.tsx
index 091b2ee750c..36199298427 100644
--- a/studio/components/interfaces/SignIn/SignInWithGitHub.tsx
+++ b/studio/components/interfaces/SignIn/SignInWithGitHub.tsx
@@ -1,9 +1,14 @@
+import { useState } from 'react'
import { BASE_PATH } from 'lib/constants'
import { auth, getReturnToPath } from 'lib/gotrue'
import { Button, IconGitHub } from 'ui'
const SignInWithGitHub = () => {
+ const [loading, setLoading] = useState(false)
+
async function handleGithubSignIn() {
+ setLoading(true)
+
try {
const { error } = await auth.signInWithOAuth({
provider: 'github',
@@ -18,6 +23,8 @@ const SignInWithGitHub = () => {
if (error) throw error
} catch (error) {
console.error(error)
+ } finally {
+ setLoading(false)
}
}
@@ -28,6 +35,7 @@ const SignInWithGitHub = () => {
icon={<IconGitHub width={18} height={18} />}
size="large"
type="default"
+ loading={loading}
>
Continue with GitHub
</Button>