Skip to content

Commit

Permalink
fix: resolved hydration problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyvid7-Darus10 committed May 28, 2023
1 parent b158b26 commit 517ac64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "face-guardian",
"version": "1.2.0",
"version": "1.2.1",
"description": "Face Guardian Components",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
Expand Down
15 changes: 9 additions & 6 deletions src/components/FaceLogin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const FaceLogin: React.FC<FaceLoginProps> = ({
buttonStyles,
buttonText = 'Face Guardian',
}) => {
const currentUrl = typeof window !== 'undefined' ? window.location.href : '';
const isClient = typeof window !== 'undefined';
const currentUrl = isClient ? window.location.href : '';

const handleButtonClick = () => {
if (typeof window !== 'undefined') {
Expand Down Expand Up @@ -76,11 +77,13 @@ const FaceLogin: React.FC<FaceLoginProps> = ({
style={combinedStyles}
disabled={!appId}
>
<img
src="https://i.ibb.co/sthHtZP/fg-logo.webp"
alt="Face Guardian Logo"
style={{ marginRight: '10px', height: '24px', width: '24px' }}
/>
{isClient && (
<img
src="https://i.ibb.co/sthHtZP/fg-logo.webp"
alt="Face Guardian Logo"
style={{ marginRight: '10px', height: '24px', width: '24px' }}
/>
)}
{buttonText}
</button>
);
Expand Down

0 comments on commit 517ac64

Please sign in to comment.