Skip to content

Commit 7de29c6

Browse files
committed
new tests to commit to repo
1 parent ed6f908 commit 7de29c6

File tree

2 files changed

+109
-88
lines changed

2 files changed

+109
-88
lines changed

bulkEmails.js

+103-19
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,107 @@
1+
const testData = [{
2+
Categories : "Participants",
3+
"Company/Organization" : null,
4+
Date : null,
5+
Email : "[email protected]",
6+
"First Name" : "JUNAIDU",
7+
"Institutional Affiliation" : null,
8+
"Last Name" : "SALISU",
9+
"Phone Number" : null
10+
}, {
11+
Categories : "Participants",
12+
"Company/Organization" : null,
13+
Date : null,
14+
Email : "[email protected]",
15+
"First Name" : "JUNAIDU",
16+
"Institutional Affiliation" : null,
17+
"Last Name" : "SALISU",
18+
"Phone Number" : null
19+
}, {
20+
Categories : "Participants",
21+
"Company/Organization" : null,
22+
Date : null,
23+
Email : "[email protected]",
24+
"First Name" : "JUNAIDU",
25+
"Institutional Affiliation" : null,
26+
"Last Name" : "SALISU",
27+
"Phone Number" : null
28+
}];
129

2-
const looper = () => {
3-
let count = 0;
4-
const setting = setInterval(function(){
5-
if (count >= 2){
6-
console.log("ended")
7-
clearInterval(setting)
8-
}
9-
else {
10-
console.log("Time Interval")
11-
count ++;
12-
}
13-
},1000 * 2);
14-
};
30+
// fetch('http://localhost:3000/api/v1/emails', {
31+
// method: 'POST',
32+
// mode: 'no-cors',
33+
// headers: {
34+
// 'Content-Type': 'application/json',
35+
// },
36+
// body: JSON.stringify({
37+
// "email" : testData[0].Email,
38+
// "name" : `${testData[0]["Last Name"]} ${testData[0]["First Name"]}`,
39+
// "category" : testData[0].Categories
40+
// }),
41+
// })
42+
// .then((response) => response.json())
43+
// .then((data) => {
44+
// console.log('success: ', data);
45+
// })
46+
47+
// async function postData(url = '', data = {}) {
48+
// // Default options are marked with *
49+
// const response = await fetch(url, {
50+
// method: 'POST',
51+
// mode: 'no-cors',
52+
// cache: 'no-cache',
53+
// credentials: 'same-origin',
54+
// headers: {
55+
// 'Content-Type': 'application/json',
56+
57+
// },
58+
59+
// body: JSON.stringify(data) // body data type must match "Content-Type" header
60+
// });
61+
// return response.text();// parses JSON response into native JavaScript objects
62+
// }
63+
64+
// postData('http://localhost:3000/api/v1/emails', {
65+
// "email" : testData[0].Email,
66+
// "name" : `${testData[0]["Last Name"]} ${testData[0]["First Name"]}`,
67+
// "category" : testData[0].Categories
68+
// })
69+
// .then((data) => {
70+
// console.log(JSON.parse(data));
71+
// });
1572

16-
looper();
73+
const looper = async (data) => {
74+
75+
for(let x = 733; x < data.length; x++){
1776

18-
fetch('https://sheet.best/api/sheets/5f05d562-cf94-492b-aac8-195d3c57ec67')
19-
.then((res) => (res.json()))
20-
.then((data) => {
21-
console.log(data)
77+
78+
await fetch('http://localhost:3000/api/v1/emails', {
79+
method: 'POST',
80+
headers: {
81+
'Content-Type': 'application/json',
82+
},
83+
body: JSON.stringify({
84+
"email" : data[x].Email,
85+
"name" : `${data[x]["Last Name"]} ${data[x]["First Name"]}`,
86+
"category" : data[x].Categories
87+
}),
88+
})
89+
.then((response) => response.json())
90+
.then((data) => {
91+
console.log(x)
92+
console.log('success: ', data);
93+
})
94+
.catch((error) => {
95+
console.error('Error: ', error);
96+
});
97+
}
98+
};
2299

23-
})
100+
//looper(testData);
101+
// console.log("Its working at this put")
102+
// fetch('https://sheet.best/api/sheets/7d520258-c5f2-4cc6-8644-436ff5e3e6c5')
103+
// .then((res) => (res.json()))
104+
// .then((data) => {
105+
// console.log(data)
106+
// looper(data);
107+
// })

index3.html

+6-69
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="en" class="w-100 h-100">
33
<head>
44
<meta charset="UTF-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -17,76 +17,13 @@
1717
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
1818
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
1919
crossorigin="anonymous"></script>
20-
<script src="./more_test.js"></script>i
21-
<script src=
22-
"https://smtpjs.com/v3/smtp.js">
23-
</script>
20+
<script src="./more_test.js"></script>
2421
<title>Document</title>
25-
<script type="text/javascript">
26-
function sendEmail() {
27-
Email.send({
28-
Host: "smtp.elasticemail.com",
29-
Username: "[email protected]",
30-
Port: "2525",
31-
Password: "ED930F949049591E09AB981289F0BCD48F52",
32-
33-
34-
Subject: "Sending Email using javascript",
35-
Body: "Well that was easy!!",
36-
})
37-
.then(function (message) {
38-
console.log("mail sent successfully", message)
39-
});
40-
}
41-
</script>
22+
4223
<link rel="stylesheet" href="./main3.css">
4324
</head>
44-
<body>
45-
<form method="post">
46-
<input type="button" value="Send Email"
47-
onclick="firstFetch()" />
48-
</form>
49-
50-
<!-- <button class="btn btn-danger" type="button" id="spreads">Fetch Spreadsheet</button> -->
51-
52-
<section id="mobile" class="p-3">
53-
<div class="container">
54-
<div class="heads d-flex justify-content-between">
55-
<a href="/">
56-
<img src="./images/digital_Nigeria_logo3.png" alt="main logo header" width="113" height="90">
57-
</a>
58-
59-
<button type="button" id="close-button">
60-
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" fill="#081c15" class="bi bi-x-circle" viewBox="0 0 16 16">
61-
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
62-
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
63-
</svg>
64-
</button>
65-
</div>
66-
67-
<ul class="nav flex-column align-items-center mobile-menu">
68-
<li class="nav-item">
69-
<a class="nav-link active" aria-current="page" href="/">HOME</a>
70-
</li>
71-
<li class="nav-item">
72-
<a class="nav-link" href="#dignitaries" title="Dignitaries">DIGNITARIES</a>
73-
</li>
74-
<li class="nav-item">
75-
<a class="nav-link" href="#register">ABOUT</a>
76-
</li>
77-
<li class="nav-item">
78-
<a class="nav-link" href="#agenda">SCHEDULE</a>
79-
</li>
80-
<li class="nav-item">
81-
<a class="nav-link" href="#patners">SPONSORS</a>
82-
</li>
83-
<li class="nav-item reg-button">
84-
<a href="/" class="btn py-2">REGISTER</a>
85-
</li>
86-
</ul>
87-
88-
89-
</div>
90-
</section>
25+
<body class="w-100 h-100 border d-flex justify-content-center align-items-center">
26+
27+
<h1 class="display-1 lead fw-bold">Registartions Are Over</h1>
9128
</body>
9229
</html>

0 commit comments

Comments
 (0)