From 992a4d773405edbbecbd6a0de49d09d616fafdfd Mon Sep 17 00:00:00 2001 From: Terry Sutton Date: Tue, 14 Jun 2022 09:35:38 -0230 Subject: [PATCH] Add OTP input checker --- studio/pages/org/[slug]/join.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/studio/pages/org/[slug]/join.tsx b/studio/pages/org/[slug]/join.tsx index 1b348d6198b..7a58d263e46 100644 --- a/studio/pages/org/[slug]/join.tsx +++ b/studio/pages/org/[slug]/join.tsx @@ -6,7 +6,7 @@ import { useRef } from 'react'; import { Button } from '@supabase/ui'; import router, {useRouter} from 'next/router'; import { useOrganizationDetail, useStore } from 'hooks' -import { post, } from 'lib/common/fetch' +import { getAccessToken, get } from 'lib/common/fetch' import { API_URL } from 'lib/constants' import { Transition } from '@headlessui/react'; @@ -51,11 +51,12 @@ const InviteCodeInput = () => { }; async function handleSubmitForm( e: any ) { + const access_token = getAccessToken() e.preventDefault(); setIsSubmitting( true ) // Need proper endpoint - const response = await post( `${API_URL}/organizations/${slug}/join?code=${result}`, {} ) + const response = await get( `${API_URL}/organizations/${slug}/join?token=${result}`, {} ) if ( response.error ) { ui.setNotification( { category: 'error', @@ -64,21 +65,22 @@ const InviteCodeInput = () => { setIsSubmitting( false ) } else { setIsSubmitting( false ) - router.push( '/' ) + // router.push( '/' ) } } + + return (
- +
-