create User type

This commit is contained in:
Ruidy Nemausat 2020-05-13 15:19:42 +02:00
parent 9fdd759e5d
commit 43212d2acd
3 changed files with 14 additions and 3 deletions

View file

@ -17,7 +17,6 @@ interface IProps {
* Main Navbar serves navigation routes. * Main Navbar serves navigation routes.
*/ */
const NavBar: FC<IProps> = ({isAuthenticated, loading}) => { const NavBar: FC<IProps> = ({isAuthenticated, loading}) => {
console.log(isAuthenticated, loading);
const publicLinks = ( const publicLinks = (
<ul data-testid="publicLinks"> <ul data-testid="publicLinks">
<li> <li>

8
src/models/User.ts Normal file
View file

@ -0,0 +1,8 @@
interface User {
name: string;
email: string;
picture: string;
createdAt: Date;
}
export default User;

View file

@ -1,17 +1,21 @@
// Redux
import {createSlice} from '@reduxjs/toolkit'; import {createSlice} from '@reduxjs/toolkit';
import {RootState} from '..'; import {RootState} from '..';
// Typing
import User from '../../models/User';
interface SliceState { interface SliceState {
isAuthenticated: boolean; isAuthenticated: boolean;
loading: boolean; loading: boolean;
// TODO: switch any by the actual user interface user: User | null;
user: any; error: string | null;
} }
const initialState: SliceState = { const initialState: SliceState = {
isAuthenticated: false, isAuthenticated: false,
loading: true, loading: true,
user: null, user: null,
error: null,
}; };
const authSlice = createSlice({ const authSlice = createSlice({