-
Notifications
You must be signed in to change notification settings - Fork 242
/
app_multi_project_init_options.js
28 lines (22 loc) · 1.08 KB
/
app_multi_project_init_options.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
// This snippet file was generated by processing the source file:
// ./firebaseapp-next/firebaseapp.js
//
// To update the snippets in this file, edit the source and then run
// 'npm run snippets'.
// [START app_multi_project_init_options_modular]
import { initializeApp, getApp } from "firebase/app";
import { getStorage } from "firebase/storage";
import { getFirestore } from "firebase/firestore";
// Initialize Firebase with a default Firebase project
initializeApp(firebaseConfig);
// Initialize Firebase with a second Firebase project
const otherProject = initializeApp(otherProjectFirebaseConfig, "other");
console.log(getApp().name); // "[DEFAULT]"
console.log(otherProject.name); // "otherProject"
// Use the shorthand notation to access the default project's Firebase services
const defaultStorage = getStorage();
const defaultFirestore = getFirestore();
// Use the otherProject variable to access the second project's Firebase services
const otherStorage = getStorage(otherProject);
const otherFirestore = getFirestore(otherProject);
// [END app_multi_project_init_options_modular]