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
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:
parent
0109739a88
commit
59eedaf102
@ -1,11 +1,11 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
const Axios = axios.create({
|
const Axios = axios.create({
|
||||||
// baseURL: 'http://localhost:5000/',
|
baseURL: 'http://localhost:5000/',
|
||||||
// baseURL: 'https://leadesh-whatsapp.onrender.com',
|
// baseURL: 'https://leadesh-whatsapp.onrender.com',
|
||||||
// baseURL: "https://api.leadesh.com/",
|
// baseURL: "https://api.leadesh.com/",
|
||||||
// baseURL: 'https://cheminova-api-2.onrender.com', // latest is this one
|
// 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
|
export default Axios
|
||||||
|
@ -17,24 +17,23 @@ const Dashboard = () => {
|
|||||||
})
|
})
|
||||||
const token = isAutheticated()
|
const token = isAutheticated()
|
||||||
// Fetch counts on component mount
|
// Fetch counts on component mount
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
// const getCounts = async () => {
|
const getCounts = async () => {
|
||||||
// try {
|
try {
|
||||||
// const res = await Axios.get('/api/get-counts-pdOrders', {
|
const res = await Axios.get('/api/get-counts-rdOrders', {
|
||||||
// headers: {
|
headers: {
|
||||||
// Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
// },
|
},
|
||||||
// }) // Updated API endpoint
|
}) // Updated API endpoint
|
||||||
// if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
// console.log('res', res)
|
setCounts(res.data.counts) // Assuming the response is in the format { new, dispatched, cancelled, processing, delivered }
|
||||||
// setCounts(res.data.counts) // Assuming the response is in the format { new, dispatched, cancelled, processing, delivered }
|
}
|
||||||
// }
|
} catch (error) {
|
||||||
// } catch (error) {
|
console.error('Failed to fetch status counts:', error)
|
||||||
// console.error('Failed to fetch status counts:', error)
|
}
|
||||||
// }
|
}
|
||||||
// }
|
getCounts()
|
||||||
// getCounts()
|
}, [])
|
||||||
// }, [])
|
|
||||||
|
|
||||||
// Define colors for different statuses
|
// Define colors for different statuses
|
||||||
const statusColors = {
|
const statusColors = {
|
||||||
@ -43,6 +42,7 @@ const Dashboard = () => {
|
|||||||
cancelled: '#f44336', // Red
|
cancelled: '#f44336', // Red
|
||||||
processing: '#ff9800', // Orange
|
processing: '#ff9800', // Orange
|
||||||
delivered: '#9c27b0', // Purple
|
delivered: '#9c27b0', // Purple
|
||||||
|
pending: '#56F000 ',
|
||||||
}
|
}
|
||||||
const statusIcons = {
|
const statusIcons = {
|
||||||
new: <AddShoppingCartIcon sx={{ fontSize: 50, color: '#fff' }} />,
|
new: <AddShoppingCartIcon sx={{ fontSize: 50, color: '#fff' }} />,
|
||||||
|
Loading…
Reference in New Issue
Block a user