-
Notifications
You must be signed in to change notification settings - Fork 1
/
Chatbase.js
102 lines (92 loc) · 2.2 KB
/
Chatbase.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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: 'AIzaSyAMqtgP2QvpK1M9qhp-OytIA4VuvDRj9L0',
authDomain: 'chatbot-f2bfd.firebaseapp.com',
databaseURL: 'https://chatbot-f2bfd.firebaseio.com',
projectId: 'chatbot-f2bfd',
storageBucket: 'chatbot-f2bfd.appspot.com',
messagingSenderId: '914652296787',
appId: '1:914652296787:web:56ad1a5405f58b51',
}
// Initialize Firebase
firebase.initializeApp(firebaseConfig)
const database = firebase.database()
// const firebaseOps = {}
const states = {
user: {
number: '',
mailid: '',
},
trip_details: {
triptype: '',
packagetype: '',
destination: '',
people: '',
dates: '',
duration: '',
},
requirements: {
facilties: '',
hotel: '',
transport: '',
calltime: '',
summary: '',
},
}
writeUserData(9876543)
{
number: 9876543
}
function writeUserData(number, obj = { number }) {
firebase
.database()
.ref('users/' + number)
.update(obj)
}
function deleteUserData(number) {
database.ref('users/' + number).remove()
}
// firebaseOps.writeUser = user_number => {
// const users = database.ref( )
// const newUser = users.push()
// newUser.set({
// number: user_number,
// // mailid: user_mail,
// })
// }
// firebaseOps.writedetails = (
// trip_type,
// user_destination,
// no_of_people,
// tentative_date,
// trip_duration,
// package_type,
// ) => {
// const users = database.ref('/users')
// const newUser = users.push()
// newUser.set({
// triptype: trip_type,
// packagetype: package_type,
// destination: user_destination,
// people: no_of_people,
// dates: tentative_date,
// duration: trip_duration,
// })
// }
// firebaseOps.writeReq = (
// req_facilities,
// hotel_preference,
// transport_type,
// cust_call_time,
// summary_req,
// ) => {
// const users = database.ref('/users')
// const newUser = users.push()
// newUser.set({
// facilties: req_facilities,
// hotel: hotel_preference,
// transport: transport_type,
// calltime: cust_call_time,
// summary: summary_req,
// })
// }