Skip to content

Commit 207e43d

Browse files
committed
Chore: EmailJs Added public keys
1 parent f971274 commit 207e43d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/components/Contact.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ function Contact() {
1111
const [name, setName] = useState<string>('');
1212
const [email, setEmail] = useState<string>('');
1313
const [message, setMessage] = useState<string>('');
14+
const [response, setResponse] = useState<string>('');
1415

1516
const [nameError, setNameError] = useState<boolean>(false);
1617
const [emailError, setEmailError] = useState<boolean>(false);
@@ -25,15 +26,12 @@ function Contact() {
2526
setEmailError(email === '');
2627
setMessageError(message === '');
2728

28-
/* Uncomment below if you want to enable the emailJS */
29+
// Non - sensitive: Public Keys
30+
const publicKey = "U9SdUxmAhEWbZ6v_C"
31+
const templateKey = "template_y874n8c"
32+
const serviceKey = "service_isqypr8"
2933

30-
const apiKey = process.env.REACT_APP_EMAIL_JS_API;
31-
const templateKey = process.env.REACT_APP_TEMPLATE_ID;
32-
const serviceKey = process.env.REACT_APP_SERVICE_ID;
33-
34-
console.log(apiKey, templateKey, serviceKey)
35-
36-
if (serviceKey === undefined || templateKey === undefined || apiKey === undefined) {
34+
if (serviceKey === undefined || templateKey === undefined || publicKey === undefined) {
3735
console.log("Undefined service, template or API key for EmailJS")
3836
return;
3937
}
@@ -45,13 +43,14 @@ function Contact() {
4543
message: message
4644
};
4745

48-
console.log(templateParams);
49-
emailjs.send(serviceKey, templateKey, templateParams, apiKey).then(
46+
emailjs.send(serviceKey, templateKey, templateParams, publicKey).then(
5047
(response) => {
5148
console.log('SUCCESS!', response.status, response.text);
49+
setResponse("Thank you! I will get back to you shortly.")
5250
},
5351
(error) => {
5452
console.log('FAILED...', error);
53+
setResponse("Something went wrong. E-mail me directly using vansh.kanojia@pace.edu.")
5554
},
5655
);
5756
setName('');
@@ -66,6 +65,7 @@ function Contact() {
6665
<div className="contact_wrapper">
6766
<h1>Contact Me</h1>
6867
<p>Got a project waiting to be realized? Let's collaborate and make it happen!</p>
68+
{response ? <p>{response}</p> : <p></p>}
6969
<Box
7070
ref={form}
7171
component="form"

0 commit comments

Comments
 (0)