Skip to content

Commit 256907e

Browse files
committed
docs: api VueFireAuth
1 parent 6cf1d09 commit 256907e

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/auth/index.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,25 @@ import { AuthUserInjectSymbol, setupOnAuthStateChanged } from './user'
77

88
export { setupOnAuthStateChanged, useCurrentUser } from './user'
99

10+
/**
11+
* VueFire Auth Module to be added to the `VueFire` Vue plugin options.
12+
*
13+
* @example
14+
*
15+
* ```ts
16+
* import { createApp } from 'vue'
17+
* import { VueFire, VueFireAuth } from 'vuefire'
18+
*
19+
* const app = createApp(App)
20+
* app.use(VueFire, {
21+
* modules: [VueFireAuth()],
22+
* })
23+
* ```
24+
*/
1025
export function VueFireAuth(_app?: never) {
26+
// ^
27+
// app: never to prevent the user from just passing `VueFireAuth` without calling the function
28+
1129
// TODO: refactor to share across modules
1230
if (process.env.NODE_ENV !== 'production') {
1331
if (_app != null) {
@@ -18,7 +36,7 @@ modules: [VueFireAuth()]`)
1836

1937
return (firebaseApp: FirebaseApp, app: App) => {
2038
const user = getGlobalScope(firebaseApp, app).run(() =>
21-
shallowRef<User | null | undefined>()
39+
shallowRef<User | null | undefined>(),
2240
)!
2341
// userMap.set(app, user)
2442
app.provide(AuthUserInjectSymbol, user)

0 commit comments

Comments
 (0)