-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBase.fs
39 lines (30 loc) · 956 Bytes
/
Base.fs
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
module Base
open Fable.Core.JsInterop
open Fable.Import
open Firebase
[<RequireQualifiedAccess>]
module Firebase =
let private firebaseObj =
createObj
[
"apiKey" ==> "AIzaSyBdzsaNt3_E_gHD2gcko4PmlHqbGxz7vrA"
"authDomain" ==> "fable-of-the-day.firebaseapp.com"
"databaseURL" ==> "https://fable-of-the-day.firebaseio.com"
]
let app =
Firebase.firebase.initializeApp (unbox firebaseObj,"roman")
[<RequireQualifiedAccess>]
module Rebase =
type private Rebase =
{
post : string -> obj -> JS.Promise<unit>
fetch : string -> obj -> JS.Promise<string>
}
type private RebaseInit = { createClass : Firebase.Database.Database -> Rebase }
let private rebaseInit : RebaseInit =
importDefault "re-base"
let private rebase = rebaseInit.createClass <| Firebase.app.database()
let fetch store =
rebase.fetch store (createObj [])
let post key value =
rebase.post key value