Skip to content

Commit 09aa567

Browse files
committed
Simplify the approach
1 parent 8be2d6c commit 09aa567

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

src/firestore/index.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -111,24 +111,6 @@ export function useDocument<T>(
111111
* @param database - name of the database
112112
* @returns the Firestore instance
113113
*/
114-
export function useFirestore(database: string): Firestore
115-
export function useFirestore(options: {
116-
name?: string
117-
database?: string
118-
}): Firestore
119-
export function useFirestore(
120-
optionsOrDatabase: string | { name?: string; database?: string }
121-
): Firestore {
122-
if (typeof optionsOrDatabase === 'string') {
123-
return getFirestore(useFirebaseApp(), optionsOrDatabase)
124-
}
125-
126-
if (optionsOrDatabase.database) {
127-
return getFirestore(
128-
useFirebaseApp(optionsOrDatabase.name),
129-
optionsOrDatabase.database
130-
)
131-
}
132-
133-
return getFirestore(useFirebaseApp(optionsOrDatabase.name))
114+
export function useFirestore(name?: string, database?: string): Firestore {
115+
return getFirestore(useFirebaseApp(name), database)
134116
}

0 commit comments

Comments
 (0)