Skip to content

Commit

Permalink
run prettier. remove try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivia Thet committed Dec 13, 2023
1 parent dbf4207 commit e42d182
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 71 deletions.
38 changes: 17 additions & 21 deletions examples/email-auth/src/components/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,24 @@ export function Auth(props: AuthProps) {
);

useEffect(() => {
try {
if (!iframeStamper) {
const iframeStamper = new IframeStamper({
iframeUrl: props.iframeUrl,
iframeContainer: document.getElementById(TurnkeyIframeContainerId),
iframeElementId: TurnkeyIframeElementId,
});
iframeStamper.init().then(() => {
setIframeStamper(iframeStamper);
props.setIframeStamper(iframeStamper);
});
}

return () => {
if (iframeStamper) {
iframeStamper.clear();
setIframeStamper(null);
}
};
} catch (error) {
console.error('Error initializing iframe stamper:', error);
if (!iframeStamper) {
const iframeStamper = new IframeStamper({
iframeUrl: props.iframeUrl,
iframeContainer: document.getElementById(TurnkeyIframeContainerId),
iframeElementId: TurnkeyIframeElementId,
});
iframeStamper.init().then(() => {
setIframeStamper(iframeStamper);
props.setIframeStamper(iframeStamper);
});
}

return () => {
if (iframeStamper) {
iframeStamper.clear();
setIframeStamper(null);
}
};
}, [props, iframeStamper, setIframeStamper]);

return <div style={{ display: "none" }} id={TurnkeyIframeContainerId}></div>;
Expand Down
38 changes: 17 additions & 21 deletions examples/email-recovery/src/components/Recovery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,24 @@ export function Recovery(props: RecoveryProps) {
);

useEffect(() => {
try {
if (!iframeStamper) {
const iframeStamper = new IframeStamper({
iframeUrl: props.iframeUrl,
iframeContainer: document.getElementById(TurnkeyIframeContainerId),
iframeElementId: TurnkeyIframeElementId,
});
iframeStamper.init().then(() => {
setIframeStamper(iframeStamper);
props.setIframeStamper(iframeStamper);
});
}

return () => {
if (iframeStamper) {
iframeStamper.clear();
setIframeStamper(null);
}
};
} catch (error) {
console.error('Error initializing iframe stamper:', error);
if (!iframeStamper) {
const iframeStamper = new IframeStamper({
iframeUrl: props.iframeUrl,
iframeContainer: document.getElementById(TurnkeyIframeContainerId),
iframeElementId: TurnkeyIframeElementId,
});
iframeStamper.init().then(() => {
setIframeStamper(iframeStamper);
props.setIframeStamper(iframeStamper);
});
}

return () => {
if (iframeStamper) {
iframeStamper.clear();
setIframeStamper(null);
}
};
}, [props, iframeStamper, setIframeStamper]);

return <div style={{ display: "none" }} id={TurnkeyIframeContainerId}></div>;
Expand Down
39 changes: 17 additions & 22 deletions examples/wallet-export/src/components/Export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,27 @@ export function Export(props: ExportProps) {
setIframeDisplay("none");
}
};

}, [props.iframeDisplay]);

useEffect(() => {
try {
if (!iframeStamper) {
const iframeStamper = new IframeStamper({
iframeUrl: props.iframeUrl,
iframeContainer: document.getElementById(TurnkeyIframeContainerId),
iframeElementId: TurnkeyIframeElementId,
});
iframeStamper.init().then(() => {
setIframeStamper(iframeStamper);
props.setIframeStamper(iframeStamper);
});
}

return () => {
if (iframeStamper) {
iframeStamper.clear();
setIframeStamper(null);
}
};
} catch (error) {
console.error('Error initializing iframe stamper:', error);
if (!iframeStamper) {
const iframeStamper = new IframeStamper({
iframeUrl: props.iframeUrl,
iframeContainer: document.getElementById(TurnkeyIframeContainerId),
iframeElementId: TurnkeyIframeElementId,
});
iframeStamper.init().then(() => {
setIframeStamper(iframeStamper);
props.setIframeStamper(iframeStamper);
});
}

return () => {
if (iframeStamper) {
iframeStamper.clear();
setIframeStamper(null);
}
};
}, [props.setIframeStamper, iframeStamper, setIframeStamper]);

const iframeCss = `
Expand Down
33 changes: 26 additions & 7 deletions examples/wallet-export/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,40 @@ export default function ExportPage() {
{selectedWallet && (
<div className={styles.reveal}>
<h2>Before you continue</h2>
<p>
By revealing the private key, you understand and agree that:
</p>
<p>By revealing the private key, you understand and agree that:</p>
<ul>
<li>
<p>You should never share your private key with anyone, including the Turnkey team. Turnkey will never ask you for your private key.</p>
<p>
You should never share your private key with anyone, including
the Turnkey team. Turnkey will never ask you for your private
key.
</p>
</li>
<li>
<p>You are responsible for the security of this private key and any assets associated with it, and Turnkey cannot help recover it on your behalf. Failure to properly secure your private key may result in total loss of the associated assets.</p>
<p>
You are responsible for the security of this private key and any
assets associated with it, and Turnkey cannot help recover it on
your behalf. Failure to properly secure your private key may
result in total loss of the associated assets.
</p>
</li>
<li>
<p>Turnkey is not responsible for any other wallet you may use with this private key, and Turnkey does not represent that any other software or hardware will be compatible with or protect your private key.</p>
<p>
Turnkey is not responsible for any other wallet you may use with
this private key, and Turnkey does not represent that any other
software or hardware will be compatible with or protect your
private key.
</p>
</li>
<li>
<p>You have read and agree to <a href="https://www.turnkey.com/files/terms-of-service.pdf">Turnkey{"\'"}s Terms of Service</a>, including the risks related to exporting your private key disclosed therein.</p>
<p>
You have read and agree to{" "}
<a href="https://www.turnkey.com/files/terms-of-service.pdf">
Turnkey{"'"}s Terms of Service
</a>
, including the risks related to exporting your private key
disclosed therein.
</p>
</li>
</ul>
<div className={styles.reveal}>
Expand Down

0 comments on commit e42d182

Please sign in to comment.