mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-12 13:36:43 +00:00
create User type
This commit is contained in:
parent
9fdd759e5d
commit
43212d2acd
3 changed files with 14 additions and 3 deletions
|
|
@ -17,7 +17,6 @@ interface IProps {
|
|||
* Main Navbar serves navigation routes.
|
||||
*/
|
||||
const NavBar: FC<IProps> = ({isAuthenticated, loading}) => {
|
||||
console.log(isAuthenticated, loading);
|
||||
const publicLinks = (
|
||||
<ul data-testid="publicLinks">
|
||||
<li>
|
||||
|
|
|
|||
8
src/models/User.ts
Normal file
8
src/models/User.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
interface User {
|
||||
name: string;
|
||||
email: string;
|
||||
picture: string;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export default User;
|
||||
|
|
@ -1,17 +1,21 @@
|
|||
// Redux
|
||||
import {createSlice} from '@reduxjs/toolkit';
|
||||
import {RootState} from '..';
|
||||
// Typing
|
||||
import User from '../../models/User';
|
||||
|
||||
interface SliceState {
|
||||
isAuthenticated: boolean;
|
||||
loading: boolean;
|
||||
// TODO: switch any by the actual user interface
|
||||
user: any;
|
||||
user: User | null;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
const initialState: SliceState = {
|
||||
isAuthenticated: false,
|
||||
loading: true,
|
||||
user: null,
|
||||
error: null,
|
||||
};
|
||||
|
||||
const authSlice = createSlice({
|
||||
|
|
|
|||
Loading…
Reference in a new issue