Removed log statement, saved authToken to auth state
This commit is contained in:
1 parent
44c9659b1d
commit
a12e200e33
2 files changed
+2
-1
No files matched your search
@@ -5,6 +5,7 @@ const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
|
|||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
|
authToken: "",
|
||||||
user: "",
|
user: "",
|
||||||
success: null,
|
success: null,
|
||||||
msg: null,
|
msg: null,
|
||||||
@@ -35,6 +36,7 @@ const handleAuthFulfilled = (state, action) => {
|
|||||||
state.isLoading = false;
|
state.isLoading = false;
|
||||||
state.success = action.payload.success;
|
state.success = action.payload.success;
|
||||||
state.msg = action.payload.msg;
|
state.msg = action.payload.msg;
|
||||||
|
state.authToken = action.payload.data;
|
||||||
const decodedToken = jwtDecode(action.payload.data);
|
const decodedToken = jwtDecode(action.payload.data);
|
||||||
const user = { ...decodedToken };
|
const user = { ...decodedToken };
|
||||||
state.user = user;
|
state.user = user;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { useSelector } from "react-redux";
|
|||||||
const HomeLayout = () => {
|
const HomeLayout = () => {
|
||||||
const authState = useSelector((state) => state.auth);
|
const authState = useSelector((state) => state.auth);
|
||||||
const { user, msg } = authState;
|
const { user, msg } = authState;
|
||||||
console.log(user, msg);
|
|
||||||
return (
|
return (
|
||||||
<div className="home-layout">
|
<div className="home-layout">
|
||||||
<DashboardSidebar />
|
<DashboardSidebar />
|
||||||
|
|||||||
Reference in new issue
Block a user