Skip to content

Commit 1b58499

Browse files
committed
Update emailjs, remove hard coded envs
1 parent b60ef71 commit 1b58499

File tree

1 file changed

+34
-21
lines changed

1 file changed

+34
-21
lines changed

src/theme/NotFound.js

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,37 @@ export default function NotFound() {
1010
const location = useLocation();
1111
const { siteConfig } = useDocusaurusContext();
1212

13-
const serverId = 'service_3xvalkw' ; // process.env.EMAILJS_SERVER_ID;
14-
const templateId = 'template_gpdzs7i' ; // process.env.EMAILJS_TEMPLATE_ID;
15-
const publicKey = 'mbYWDBjQhv-h3CLXl'; // process.env.EMAILJS_PUBLIC_KEY;
13+
const serverId = siteConfig.customFields.EMAILJS_SERVER_ID
14+
const templateId = siteConfig.customFields.EMAILJS_TEMPLATE_ID
15+
const publicKey = siteConfig.customFields.EMAILJS_PUBLIC_KEY
1616

17-
//console.log('serverId :' + serverId );
18-
//console.log('templateId :' + templateId );
19-
//console.log('publicKey :' + publicKey );
20-
21-
useEffect(async () => {
22-
emailjs.send(serverId, templateId, { url: "https://docs.appseed.us" + location.pathname }, publicKey).then(
23-
function (response) {
24-
console.log("SUCCESS!", response.status, response.text);
25-
},
26-
function (error) {
27-
console.log("FAILED...", error);
28-
}
29-
);
30-
}, []);
17+
useEffect(() => {
18+
if (!serverId || !templateId || !publicKey) return
19+
20+
async function emailJS() {
21+
emailjs
22+
.send(
23+
serverId,
24+
templateId,
25+
{
26+
url:
27+
'https://docusaurus-soft-design.onrender.com' +
28+
location.pathname,
29+
},
30+
publicKey
31+
)
32+
.then(
33+
function (response) {
34+
console.log('SUCCESS!', response.status, response.text)
35+
},
36+
function (error) {
37+
console.log('FAILED...', error)
38+
}
39+
)
40+
}
41+
42+
emailJS()
43+
}, [])
3144
return (
3245
<>
3346
<PageMetadata
@@ -45,18 +58,18 @@ export default function NotFound() {
4558
Page Not Found
4659
</Translate>
4760
</h1>
48-
<p>
61+
<div>
4962
<Translate id="theme.NotFound.p1" description="The first paragraph of the 404 page">
5063
Sorry but the page you were looking for could not be found.
5164
</Translate>
52-
</p>
53-
<p>
65+
</div>
66+
<div>
5467
<div className="py-4 md:mr-20 justify-center ">
5568
<Link className="bg-white no-underline hover:no-underline rounded-md text-black px-4 py-2 " to="/">
5669
Back to Home Page
5770
</Link>
5871
</div>
59-
</p>
72+
</div>
6073
</div>
6174
</div>
6275
</main>

0 commit comments

Comments
 (0)