From 01ee16b99bf66684f8fa110f5060502ff21026cf Mon Sep 17 00:00:00 2001
From: Kang Ming
Date: Mon, 6 Dec 2021 21:01:58 +0800
Subject: [PATCH] fix: use gotrue on client if enabled
---
studio/components/interfaces/Home/Landing.tsx | 33 ++++++++++++++++---
.../layouts/AccountLayout/AccountLayout.tsx | 32 ++++++++++++++----
2 files changed, 54 insertions(+), 11 deletions(-)
diff --git a/studio/components/interfaces/Home/Landing.tsx b/studio/components/interfaces/Home/Landing.tsx
index cc6142e7b76..d22ee1371c7 100644
--- a/studio/components/interfaces/Home/Landing.tsx
+++ b/studio/components/interfaces/Home/Landing.tsx
@@ -2,15 +2,32 @@ import Image from 'next/image'
import Link from 'next/link'
import Head from 'next/head'
import { observer } from 'mobx-react-lite'
-import { Button, Typography } from '@supabase/ui'
+import { Button, IconGitHub, Typography } from '@supabase/ui'
import { API_URL } from 'lib/constants'
import { useStore } from 'hooks'
+import { auth, GOTRUE_ENABLED } from 'lib/gotrue'
const Landing = () => {
const { ui } = useStore()
const { theme } = ui
+ async function handleGithubSignIn() {
+ try {
+ const { user, session, error } = await auth.signIn(
+ {
+ provider: 'github',
+ },
+ {
+ redirectTo: process.env.NEXT_PUBLIC_SITE_URL,
+ }
+ )
+ if (error) throw error
+ } catch (error) {
+ console.error(error)
+ }
+ }
+
return (
@@ -38,7 +55,10 @@ const Landing = () => {
type="success"
className="ml-8 font-medium hover:text-gray-300 focus:outline-none focus:text-gray-300 transition duration-150 ease-in-out"
>
- Sign In
+ {GOTRUE_ENABLED ?
+ }>Sign In With Github
+ : Sign In
+ }
@@ -55,9 +75,12 @@ const Landing = () => {
-
-
-
+ {GOTRUE_ENABLED ?
+ }>Sign In With Github
+ :
+
+
+ }