-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathupdate.html
72 lines (65 loc) · 1.97 KB
/
update.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!-- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.10/firebase-app.js";
import { getAuth } from "https://www.gstatic.com/firebasejs/9.6.10/firebase-auth.js";
import {
getFirestore,
addDoc,
collection,
} from "https://www.gstatic.com/firebasejs/9.6.10/firebase-firestore.js";
import womenNgos from "./dist/js/data.js";
const firebaseConfig = {
apiKey: "AIzaSyAH0cGACFs08M3rrD3_swwDpltG2KzzzCY",
authDomain: "gsolution-754c5.firebaseapp.com",
projectId: "gsolution-754c5",
storageBucket: "gsolution-754c5.appspot.com",
messagingSenderId: "307270571076",
appId: "1:307270571076:web:4f1c5083864fab91621811",
measurementId: "G-PG6XWR2DPQ",
};
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
var ngoSchema = (name, phone, email, address, longitude, latitude) => ({
name: name,
contact: {
phone: phone,
email: "N/A" || email,
address: address,
},
coordinates: {
longitude: longitude,
latitude: latitude,
},
});
function updateDoc(data) {
addDoc(
collection(db, "users"),
ngoSchema(
data.name,
data.phone,
"N/A",
data.address,
data.lon,
data.lat
)
).catch((error) => {
console.log(error);
});
}
const ngoData = womenNgos.womensNgo.ngoDetails;
// console.log();
ngoData.forEach((data) => {
updateDoc(data);
console.log(data);
});
</script>
</body>
</html> -->