diff --git a/studio/pages/join/index.tsx b/studio/pages/join/index.tsx index 7bc410273b5..54b133b526b 100644 --- a/studio/pages/join/index.tsx +++ b/studio/pages/join/index.tsx @@ -1,6 +1,6 @@ import React from 'react' import { useProfile, useStore } from 'hooks' -import { Button, IconAlertCircle, IconCheck, IconCheckSquare, IconXSquare } from '@supabase/ui' +import { Button, IconCheckSquare } from '@supabase/ui' import { useState } from 'react' import { useRouter } from 'next/router' import Link from 'next/link' @@ -9,7 +9,7 @@ import { get, post, delete_ } from 'lib/common/fetch' import { useEffect } from 'react' import { auth } from 'lib/gotrue' -interface TokenInfoI { +interface ITokenInfo { organization_name?: string | undefined token_does_not_exist?: boolean email_match?: boolean @@ -18,13 +18,13 @@ interface TokenInfoI { invite_id?: number } -type TokenInfo = TokenInfoI | undefined +type TokenInfo = ITokenInfo | undefined -const User = () => { +const JoinOrganizationPage = () => { const router = useRouter() const { slug, token } = router.query const { ui, app } = useStore() - const { profile, isLoading } = useProfile() + const { profile } = useProfile() const [isSubmitting, setIsSubmitting] = useState(false) const [tokenValidationInfo, setTokenValidationInfo] = useState(undefined) @@ -38,9 +38,7 @@ const User = () => { invite_id, } = tokenValidationInfo || {} - const loginRedirectLink = `/?next=${encodeURIComponent( - `/join?token=${router.query.token}&slug=${router.query.slug}` - )}` + const loginRedirectLink = `/?next=${encodeURIComponent(`/join?token=${token}&slug=${slug}`)}` useEffect(() => { const fetchTokenInfo = async () => { @@ -57,10 +55,10 @@ const User = () => { } } - if (router.query.token && !tokenInfoLoaded) { + if (token && !tokenInfoLoaded) { fetchTokenInfo() } - }, [router.query]) + }, [token]) async function handleJoinOrganization() { setIsSubmitting(true) @@ -102,18 +100,6 @@ const User = () => { (tokenInfoLoaded && expired_token) const ErrorMessage = () => { - const Container = ({ children }: { children: React.ReactNode }) => ( -
- {/* */} - <>{children} -
- ) - const message = token_does_not_exist ? ( <>

The invite token is invalid.

@@ -152,11 +138,26 @@ const User = () => { '' ) - return {message} + return ( +
+ {message} +
+ ) } return ( -
+
{ className=" bg-scale-300 border-scale-400 mx-auto overflow-hidden rounded-md border text-center shadow - md:w-[380px] + md:w-[400px] " >
- {/*

Organization invitation

*/} - {!token_does_not_exist ? ( <>

You have been invited to join

@@ -205,13 +204,7 @@ const User = () => {
{authorized_user && !expired_token && email_match && tokenInfoLoaded && (
-