-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix:remove playground and unnecessary files * feat: added payment * fix: env vars * fix: env vars * fix: hydration err
- Loading branch information
Showing
2 changed files
with
15 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,39 +5,35 @@ import { PayContainer } from './payment.styles'; | |
import Cookies from 'js-cookie'; | ||
|
||
const PaymentPage = () => { | ||
const [isClient, setIsClient] = useState(false); | ||
const [userEmail, setUserEmail] = useState(''); | ||
const [userEmail, setUserEmail] = useState(null); | ||
|
||
useEffect(() => { | ||
setIsClient(true); | ||
const userData = Cookies.get('userData'); | ||
const email = (userData && JSON.parse(userData).email) || ''; | ||
setUserEmail(email); | ||
}, []); | ||
|
||
const validEmails = [ | ||
const validMails = [ | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
]; | ||
|
||
if (!isClient) { | ||
return null; | ||
if (userEmail === null) { | ||
return <div>Loading...</div>; | ||
} | ||
|
||
return ( | ||
<div> | ||
<PayContainer> | ||
{validEmails.includes(userEmail) ? ( | ||
<> | ||
<h1>Payment Page</h1> | ||
<PayButton /> | ||
</> | ||
) : ( | ||
<h1>404 page not found</h1> | ||
)} | ||
</PayContainer> | ||
</div> | ||
<PayContainer> | ||
{validMails.includes(userEmail) ? ( | ||
<div> | ||
<h1>Payment Page</h1> | ||
<PayButton /> | ||
</div> | ||
) : ( | ||
<h1>404 page not found</h1> | ||
)} | ||
</PayContainer> | ||
); | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters