How to use rxfire - 10 common examples

To help you get started, we’ve selected a few rxfire examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AngularFirebase / 131-rxfire-stencil-todos / src / components / my-component / my-component.tsx View on Github external
switchMap(user => {
          // Define the query
          if (user) {
            const query = this.ref.where('user', '==', user.uid);
            return collectionData(query, 'taskId');
          } else {
            return [];
          }
        })
      )
github AngularFirebase / 131-rxfire-stencil-todos / src / components / my-component / my-component.tsx View on Github external
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));
  }
github AngularFirebase / 131-rxfire-stencil-todos / src / components / my-component / my-component.tsx View on Github external
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));
  }
github FirebaseExtended / reactfire / reactfire / auth / index.tsx View on Github external
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);
}
github CreativeBuilds / creative-bot / src / renderer / helpers / rxUsers.ts View on Github external
(user): ObservableInput => {
      if (!user) {
        return [];
      }

      const firestoreReference = firestore
        .collection('users')
        .doc(user.uid)
        .collection('users');

      return collectionData(firestoreReference);
    }
  ),
github CreativeBuilds / creative-bot / src / renderer / helpers / db / db.ts View on Github external
(user): ObservableInput => {
      if (!user) {
        return [];
      }

      const firestoreReference = firestore
        .collection('users')
        .doc(user.uid)
        .collection('users');

      return collectionData(firestoreReference);
    }
  ),
github jsayol / FireSQL / src / rx / index.ts View on Github external
queries.map(query =>
      collectionData(query, idField)
    )
github CreativeBuilds / creative-bot / src / renderer / helpers / rxCommands.ts View on Github external
(authUser): ObservableInput => {
      if (!authUser) {
        return empty();
      }
      const ref = firestore
        .collection('users')
        .doc(authUser.uid)
        .collection('commands');

      return collectionData(ref);
    }
  ),
github FirebaseExtended / reactfire / reactfire / firestore / index.tsx View on Github external
export function useFirestoreCollectionData(
  query: firestore.Query,
  options?: ReactFireOptions
): T[] {
  const queryId = getHashFromFirestoreQuery(query);

  return useObservable(
    collectionData(query, checkIdField(options)),
    queryId,
    checkStartWithValue(options)
  );
}
github CreativeBuilds / creative-bot / src / renderer / helpers / rxCustomVariables.ts View on Github external
(authUser): ObservableInput => {
      if (!authUser) {
        return empty();
      }

      const ref = firestore
        .collection('configs')
        .doc(authUser.uid)
        .collection('custom_variables');

      return collectionData(ref);
    }
  ),