From 4775e655e2100db2a8fc5536cb6b0ffd8d164912 Mon Sep 17 00:00:00 2001 From: ROSHAN GARG Date: Mon, 9 Sep 2024 17:08:05 +0530 Subject: [PATCH] update theme mode --- src/App.js | 2 +- src/views/dashboard/Dashboard.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/App.js b/src/App.js index 340eb53..b6522ba 100644 --- a/src/App.js +++ b/src/App.js @@ -18,7 +18,7 @@ const ForgetPassword = React.lazy(() => import('./views/pages/forgetPassword')) const App = () => { const { isColorModeSet, setColorMode } = useColorModes('coreui-free-react-admin-template-theme') - const storedTheme = useSelector((state) => state.theme) + const storedTheme = 'light' console.log('theme1', storedTheme) useEffect(() => { diff --git a/src/views/dashboard/Dashboard.js b/src/views/dashboard/Dashboard.js index 2f886f1..cd41cbf 100644 --- a/src/views/dashboard/Dashboard.js +++ b/src/views/dashboard/Dashboard.js @@ -6,6 +6,7 @@ import LocalShippingIcon from '@mui/icons-material/LocalShipping' import CancelIcon from '@mui/icons-material/Cancel' import HourglassEmptyIcon from '@mui/icons-material/HourglassEmpty' import CheckCircleIcon from '@mui/icons-material/CheckCircle' +import { isAutheticated } from '../../auth' const Dashboard = () => { const [counts, setCounts] = useState({ new: 0, @@ -14,12 +15,16 @@ const Dashboard = () => { processing: 0, delivered: 0, }) - + const token = isAutheticated() // Fetch counts on component mount useEffect(() => { const getCounts = async () => { try { - const res = await Axios.get('/api/get-counts-pdOrders') // Updated API endpoint + const res = await Axios.get('/api/get-counts-pdOrders', { + headers: { + Authorization: `Bearer ${token}`, + }, + }) // Updated API endpoint if (res.status === 200) { console.log('res', res) setCounts(res.data.counts) // Assuming the response is in the format { new, dispatched, cancelled, processing, delivered }