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 }