Skip to content

Commit

Permalink
Signup Modal Success Message - Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
iamibrahimriaz committed Jul 15, 2024
1 parent 901e244 commit ba4c9f9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
36 changes: 21 additions & 15 deletions src/js/components/Popup/AuthModal.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { useState } from '@wordpress/element';
import ReactSVG from 'react-inlinesvg';
import SignInContent from '@modules/SignIn/SignInContent';
import SignUpContent from '@modules/SignUp/SignUpContent';
import { useState } from '@wordpress/element';
import ReactSVG from 'react-inlinesvg';
import { AuthModalStyle } from './style';

import closeIcon from '@icon/close.svg';

const AuthModal = ( { onClose } ) => {
const [ signUpModal, openSignUpModal ] = useState( false );
const [isSignedUp, setIsSignedUp] = useState(false);

let closeAuthModal = () => {
let templatiqRoot = document.querySelector( '.templatiq' );
Expand All @@ -25,25 +26,30 @@ const AuthModal = ( { onClose } ) => {

return (
<AuthModalStyle className="templatiq__modal">
{ ! signUpModal ? <SignInContent /> : <SignUpContent /> }
{ ! signUpModal ?
<SignInContent /> :
<SignUpContent setIsSignedUp={setIsSignedUp} />
}
<button
className="templatiq__modal__cancel__button"
onClick={ closeAuthModal }
>
<ReactSVG src={ closeIcon } width={ 20 } height={ 20 } />
</button>
<div className="templatiq__modal__bottom">
{ ! signUpModal
? "Don't have an account?"
: 'Already have an account?' }{ ' ' }
<a
href=""
className="templatiq__modal__another__btn"
onClick={ openAnotherModal }
>
{ ! signUpModal ? 'Sign up' : 'Sign in' }
</a>
</div>
{!isSignedUp && (
<div className="templatiq__modal__bottom">
{!signUpModal
? "Don't have an account?"
: 'Already have an account?'}{' '}
<a
href="#"
className="templatiq__modal__another__btn"
onClick={openAnotherModal}
>
{!signUpModal ? 'Sign up' : 'Sign in'}
</a>
</div>
)}
</AuthModalStyle>
);
};
Expand Down
3 changes: 2 additions & 1 deletion src/js/modules/SignUp/SignUpContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Link, useNavigate } from 'react-router-dom';
import store from '@store/index';
import { select } from '@wordpress/data';

export default function SignUpContent() {
export default function SignUpContent({ setIsSignedUp }) {
const navigate = useNavigate();

let [ loading, setLoading ] = useState( false );
Expand Down Expand Up @@ -41,6 +41,7 @@ export default function SignUpContent() {
postData( singUpEndPoint, credentials ).then( ( data ) => {
if ( data?.body?.token ) {
setIsRegistered( true );
setIsSignedUp( true );
// navigate( '/signin' );
} else {
const errorMessage = data.message || 'Something went wrong';
Expand Down

0 comments on commit ba4c9f9

Please sign in to comment.