Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
switchMap(user => {
// Define the query
if (user) {
const query = this.ref.where('user', '==', user.uid);
return collectionData(query, 'taskId');
} else {
return [];
}
})
)
componentWillLoad() {
authState(firebase.auth()).subscribe(u => (this.user = u));
// Get associated user todos
authState(firebase.auth())
.pipe(
switchMap(user => {
// Define the query
if (user) {
const query = this.ref.where('user', '==', user.uid);
return collectionData(query, 'taskId');
} else {
return [];
}
})
)
.subscribe(docs => (this.todos = docs));
}
componentWillLoad() {
authState(firebase.auth()).subscribe(u => (this.user = u));
// Get associated user todos
authState(firebase.auth())
.pipe(
switchMap(user => {
// Define the query
if (user) {
const query = this.ref.where('user', '==', user.uid);
return collectionData(query, 'taskId');
} else {
return [];
}
})
)
.subscribe(docs => (this.todos = docs));
}
auth?: auth.Auth,
options?: ReactFireOptions
): User | T {
auth = auth || useAuth()();
let currentUser = undefined;
if (options && options.startWithValue !== undefined) {
currentUser = options.startWithValue;
} else if (auth.currentUser) {
// if auth.currentUser is undefined or null, we won't use it
// because null can mean "not signed in" OR "still loading"
currentUser = auth.currentUser;
}
return useObservable(user(auth), 'auth: user', currentUser);
}
(user): ObservableInput => {
if (!user) {
return [];
}
const firestoreReference = firestore
.collection('users')
.doc(user.uid)
.collection('users');
return collectionData(firestoreReference);
}
),
(user): ObservableInput => {
if (!user) {
return [];
}
const firestoreReference = firestore
.collection('users')
.doc(user.uid)
.collection('users');
return collectionData(firestoreReference);
}
),
queries.map(query =>
collectionData(query, idField)
)
(authUser): ObservableInput => {
if (!authUser) {
return empty();
}
const ref = firestore
.collection('users')
.doc(authUser.uid)
.collection('commands');
return collectionData(ref);
}
),
export function useFirestoreCollectionData(
query: firestore.Query,
options?: ReactFireOptions
): T[] {
const queryId = getHashFromFirestoreQuery(query);
return useObservable(
collectionData(query, checkIdField(options)),
queryId,
checkStartWithValue(options)
);
}
(authUser): ObservableInput => {
if (!authUser) {
return empty();
}
const ref = firestore
.collection('configs')
.doc(authUser.uid)
.collection('custom_variables');
return collectionData(ref);
}
),