How to use the react-redux-firebase.isLoaded function in react-redux-firebase

To help you get started, we’ve selected a few react-redux-firebase 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 prescottprue / generator-react-firebase / examples / react-firebase-redux / src / containers / Navbar / Navbar.js View on Github external
function Navbar() {
  const classes = useStyles()

  // Get auth from redux state
  const auth = useSelector(state => state.firebase.auth)
  const authExists = isLoaded(auth) && !isEmpty(auth)

  return (
    <NavbarWithoutAuth brandPath={authExists ? LIST_PATH : '/'}>
      {authExists ? (
        <AccountMenu />
      ) : (
        <Button
          className={classes.signIn}
          component={Link}
          to={LOGIN_PATH}
          data-test="sign-in">
          Sign In
        </Button>
      )}
    </NavbarWithoutAuth>
  )
github prescottprue / react-redux-firebase / examples / complete / material / src / containers / Navbar / Navbar.enhancer.js View on Github external
withProps(({ auth, profile }) => ({
    authExists: isLoaded(auth) && !isEmpty(auth)
  })),
  // Flatten profile so that avatarUrl and displayName are props
github mapswipe / mapswipe / src / shared / views / Login.js View on Github external
componentDidUpdate(prevProps: Props) {
        const { auth, navigation } = this.props;
        if (auth !== prevProps.auth) {
            if (isLoaded(auth) && !isEmpty(auth)) {
                navigation.navigate('ProjectNav');
            }
        }
    }
github NUS-ALSET / achievements / src / containers / ActivitySolutions / ActivitySolutions.js View on Github external
render() {
    const activity = this.props.activity || {};
    const problemSolutions = this.props.problemSolutions || {};
    const { open, dialogData, showSolutionFor } = this.state;
    const { student, solution } = dialogData || {};
    if (
      isLoaded(this.props.activity) &&
      this.props.uid !== this.props.activity.owner
    ) {
      return (
        <Typography style={{ textAlign: "center", marginTop: 55 }} variant="h5">
          You are not the owner of this activity.
        </Typography>
      );
    }
    const hasLoaded =
      isLoaded(this.props.activity) && isLoaded(this.props.problemSolutions);

    if (!hasLoaded) {
      return (
        <Typography style={{ textAlign: "center", marginTop: 55 }} variant="h5">
          Loading...
        </Typography>
github ChingStore / ching / src / components / onboarding / sign-up-oauth / index.js View on Github external
checkAuthStatusAndStage = () => {
    const { userId, storeId, history } = this.props
    const { refreshIntervalId } = this.state

    if (ReactReduxFirebase.isLoaded()) {
      clearInterval(refreshIntervalId)

      this.setState({ loading: false })

      if (userId && storeId) {
        history.push(ROUTE.PATH.STORE)
      }

      if (userId && !storeId) {
        history.push(ROUTE.PATH.SIGN_UP_STORE)
      }
    }
  }
github prescottprue / react-redux-firebase / examples / complete / typescript / src / List.tsx View on Github external
function List() {
  useFirestoreConnect([{
    collection: "todos",
  }]);
  const todos = useSelector((state: SystemState) => state.firebase.data.todos);
  if (!isLoaded(todos)) { return "Loading..."; }
  if (isEmpty(todos)) { return null; }
  return (
    <ul>
      {todos.map((todo: any) => (
        <li key={todo.id}>{todo.name}</li>
      ))}
    </ul>
  );
}
github prescottprue / react-redux-firebase / examples / complete / simple / src / Home.js View on Github external
<div className='App-header'>
        <h2>react-redux-firebase demo</h2>
        <img src={logo} className='App-logo' alt='logo' />
      </div>
      <div className='App-todos'>
        <h4>
          Loaded From
          <span className='App-Url'>
            <a href='https://redux-firebasev3.firebaseio.com/'>
              redux-firebasev3.firebaseio.com
            </a>
          </span>
        </h4>
        <h4>Todos List</h4>
        {
          !isLoaded(todos)
            ? 'Loading'
            : isEmpty(todos)
              ? 'Todo list is empty'
              : todos.reverse().map(({ value: todo, key }, ind) => (
                <TodoItem
                  key={`${key}-${ind}`}
                  id={key}
                  {...todo}
                />
              ))
        }
        <NewTodo />
      </div>
    </div>
  )
}
github ChingStore / ching / src / components / root / index.js View on Github external
isLoaded = (): boolean => {
    const { auth, items, orders, currentUser, currentStore } = this.props
    return ReactReduxFirebase.isLoaded(
      auth,
      items,
      orders,
      currentUser,
      currentStore
    )
  }
}