Skip to content

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

Add OTP input checker

Terry Sutton992a4d773405
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 (
<form onSubmit={handleSubmitForm} ref={AuthInputFormRef}>
<div>
- <AuthCode ref={AuthInputRef} allowedCharacters='alpha' onChange={handleOnChange} length={15} autoFocus={true} containerClassName="join-auth-code-container flex items-center max-w-full" inputClassName="w-[44px]" />
+ <AuthCode ref={AuthInputRef} allowedCharacters='alphanumeric' onChange={handleOnChange} length={15} autoFocus={true} containerClassName="join-auth-code-container flex items-center max-w-full" inputClassName="w-[34px]" />
<div className='flex items-center gap-2 mt-8'>
<Button disabled={!isValidInviteCode} htmlType="submit" loading={isSubmitting} size="small">
Join this organization
</Button>
-
<Transition
show={isInputDirty}
enter="transition ease-out duration-500"