dashboard api done
Some checks failed
NPM Installation / build (16.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (16.x, windows-latest) (push) Has been cancelled
NPM Installation / build (17.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (17.x, windows-latest) (push) Has been cancelled
NPM Installation / build (18.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (18.x, windows-latest) (push) Has been cancelled

This commit is contained in:
ROSHAN GARG 2024-10-18 16:20:10 +05:30
parent 0109739a88
commit 59eedaf102
2 changed files with 20 additions and 20 deletions

View File

@ -1,11 +1,11 @@
import axios from 'axios'
const Axios = axios.create({
// baseURL: 'http://localhost:5000/',
baseURL: 'http://localhost:5000/',
// baseURL: 'https://leadesh-whatsapp.onrender.com',
// baseURL: "https://api.leadesh.com/",
// baseURL: 'https://cheminova-api-2.onrender.com', // latest is this one
baseURL: 'https://api.cnapp.co.in', // latest is this one
// baseURL: 'https://api.cnapp.co.in', // latest is this one
})
export default Axios

View File

@ -17,24 +17,23 @@ const Dashboard = () => {
})
const token = isAutheticated()
// Fetch counts on component mount
// useEffect(() => {
// const getCounts = async () => {
// try {
// 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 }
// }
// } catch (error) {
// console.error('Failed to fetch status counts:', error)
// }
// }
// getCounts()
// }, [])
useEffect(() => {
const getCounts = async () => {
try {
const res = await Axios.get('/api/get-counts-rdOrders', {
headers: {
Authorization: `Bearer ${token}`,
},
}) // Updated API endpoint
if (res.status === 200) {
setCounts(res.data.counts) // Assuming the response is in the format { new, dispatched, cancelled, processing, delivered }
}
} catch (error) {
console.error('Failed to fetch status counts:', error)
}
}
getCounts()
}, [])
// Define colors for different statuses
const statusColors = {
@ -43,6 +42,7 @@ const Dashboard = () => {
cancelled: '#f44336', // Red
processing: '#ff9800', // Orange
delivered: '#9c27b0', // Purple
pending: '#56F000 ',
}
const statusIcons = {
new: <AddShoppingCartIcon sx={{ fontSize: 50, color: '#fff' }} />,