mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-12 13:36:43 +00:00
install firestore
This commit is contained in:
parent
0196ab4b9a
commit
e87094170e
3 changed files with 14 additions and 13 deletions
|
|
@ -3,20 +3,22 @@ import React, {FC} from 'react';
|
|||
import {Link} from 'react-router-dom';
|
||||
import * as ROUTES from '../constants/routes';
|
||||
//Redux
|
||||
// import {connect} from 'react-redux';
|
||||
import {connect} from 'react-redux';
|
||||
import {selectProfile} from '../store/firebase';
|
||||
// import {selectAuthState} from '../store/auth';
|
||||
// Style
|
||||
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
||||
import {faCode, faSignOutAlt, faUser} from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
interface IProps {
|
||||
isAuthenticated?: boolean;
|
||||
loading?: boolean;
|
||||
isEmpty: boolean;
|
||||
isLoaded: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main Navbar serves navigation routes.
|
||||
*/
|
||||
const NavBar: FC<IProps> = ({isAuthenticated = true, loading = false}) => {
|
||||
const NavBar: FC<IProps> = ({isEmpty, isLoaded}) => {
|
||||
const publicLinks = (
|
||||
<ul data-testid="publicLinks">
|
||||
<li>
|
||||
|
|
@ -65,7 +67,7 @@ const NavBar: FC<IProps> = ({isAuthenticated = true, loading = false}) => {
|
|||
);
|
||||
|
||||
/** Display appropriated links after loading given authenticated prop */
|
||||
const RenderLinks = !loading && isAuthenticated ? privateLinks : publicLinks;
|
||||
const RenderLinks = !isLoaded && !isEmpty ? privateLinks : publicLinks;
|
||||
|
||||
return (
|
||||
<nav className="navbar bg-dark">
|
||||
|
|
@ -80,5 +82,5 @@ const NavBar: FC<IProps> = ({isAuthenticated = true, loading = false}) => {
|
|||
};
|
||||
|
||||
/** connect HOC subscribes to the store */
|
||||
export default NavBar;
|
||||
//connect(selectAuthState)(NavBar);
|
||||
export default connect(selectProfile)(NavBar);
|
||||
//NavBar;
|
||||
|
|
|
|||
|
|
@ -2,3 +2,5 @@ import {RootState} from '..';
|
|||
|
||||
/** export firebase authentication */
|
||||
export const selectAuthState = (state: RootState) => state.firebase.auth;
|
||||
/** export current user profile */
|
||||
export const selectProfile = (state: RootState) => state.firebase.profile;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
// Redux
|
||||
import {configureStore} from '@reduxjs/toolkit';
|
||||
import authReducer from './auth/';
|
||||
// import authReducer from './auth/';
|
||||
// Firebase
|
||||
import {
|
||||
firebaseReducer,
|
||||
FirebaseReducer,
|
||||
firestoreReducer,
|
||||
} from 'react-redux-firebase';
|
||||
import {firebaseReducer, FirebaseReducer} from 'react-redux-firebase';
|
||||
import {firestoreReducer} from 'redux-firestore';
|
||||
// Typing
|
||||
import User from '../models/User';
|
||||
import {Schema} from './firebase/config';
|
||||
|
|
|
|||
Loading…
Reference in a new issue