@@ -63,25 +63,11 @@ function getInputValue(elementId) {
63
63
}
64
64
65
65
function getFid ( ) {
66
- const projectId = getInputValue ( 'projectId' ) ;
67
- const apiKey = getInputValue ( 'apiKey' ) ;
68
- const appId = getInputValue ( 'appId' ) ;
69
- printRequest (
70
- 'Get FID' ,
71
- FirebaseInstallations . getFid ( { options : { projectId, apiKey, appId } } )
72
- ) ;
66
+ printRequest ( 'Get FID' , FirebaseInstallations . getFid ( getApp ( ) ) ) ;
73
67
}
74
68
75
69
function getAuthToken ( ) {
76
- const projectId = getInputValue ( 'projectId' ) ;
77
- const apiKey = getInputValue ( 'apiKey' ) ;
78
- const appId = getInputValue ( 'appId' ) ;
79
- printRequest (
80
- 'Get Auth Token' ,
81
- FirebaseInstallations . getAuthToken ( {
82
- options : { projectId, apiKey, appId }
83
- } )
84
- ) ;
70
+ printRequest ( 'Get Auth Token' , FirebaseInstallations . getAuthToken ( getApp ( ) ) ) ;
85
71
}
86
72
87
73
async function printRequest ( requestInfo , promise ) {
@@ -103,6 +89,17 @@ function format(o) {
103
89
return `<span class="formatted-content">${ escapedString } </span>` ;
104
90
}
105
91
92
+ function getApp ( ) {
93
+ const appName = getInputValue ( 'appName' ) ;
94
+ const projectId = getInputValue ( 'projectId' ) ;
95
+ const apiKey = getInputValue ( 'apiKey' ) ;
96
+ const appId = getInputValue ( 'appId' ) ;
97
+ return {
98
+ name : appName ,
99
+ options : { projectId, apiKey, appId }
100
+ } ;
101
+ }
102
+
106
103
getElement ( 'getFid' ) . onclick = getFid ;
107
104
getElement ( 'getAuthToken' ) . onclick = getAuthToken ;
108
105
getElement ( 'clearDb' ) . onclick = clearDb ;
0 commit comments