resolved the error of the KYC
Some checks are pending
NPM Installation / build (16.x, ubuntu-latest) (push) Waiting to run
NPM Installation / build (16.x, windows-latest) (push) Waiting to run
NPM Installation / build (17.x, ubuntu-latest) (push) Waiting to run
NPM Installation / build (17.x, windows-latest) (push) Waiting to run
NPM Installation / build (18.x, ubuntu-latest) (push) Waiting to run
NPM Installation / build (18.x, windows-latest) (push) Waiting to run

This commit is contained in:
ROSHAN GARG 2024-09-11 10:08:03 +05:30
parent 4775e655e2
commit 0677909835
10 changed files with 17 additions and 23 deletions

View File

@ -7,10 +7,9 @@ import { jwtDecode } from 'jwt-decode'
const isTokenExpired = (token) => { const isTokenExpired = (token) => {
try { try {
const decodedToken = jwtDecode(token) const decodedToken = jwtDecode(token)
console.log('Decoded Token:', decodedToken) // Debugging
const currentTime = Date.now() / 1000 const currentTime = Date.now() / 1000
console.log('Current Time:', currentTime) // Debugging gging
console.log('Token Expiration Time:', decodedToken.exp) // Debugging
return decodedToken.exp < currentTime return decodedToken.exp < currentTime
} catch (error) { } catch (error) {
console.error('Error decoding token:', error) // Debugging console.error('Error decoding token:', error) // Debugging
@ -24,9 +23,8 @@ const ProtectedRoute = ({ element: Element }) => {
useEffect(() => { useEffect(() => {
const checkToken = () => { const checkToken = () => {
const token = localStorage.getItem('authToken') const token = localStorage.getItem('authToken')
console.log('Token:', token) // Debugging
if (!token || isTokenExpired(token)) { if (!token || isTokenExpired(token)) {
console.log('Token is expired or not present, redirecting to login')
navigate('/login') navigate('/login')
} else { } else {
console.log('Token is valid') console.log('Token is valid')

View File

@ -26,7 +26,6 @@ const Dashboard = () => {
}, },
}) // 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) {

View File

@ -36,7 +36,6 @@ const OrderDetails = () => {
setOwnerDetails({ ...res.data.user }) setOwnerDetails({ ...res.data.user })
} }
} }
console.log('order', order)
useEffect(() => { useEffect(() => {
const fetchOrderDetails = async () => { const fetchOrderDetails = async () => {
try { try {
@ -46,7 +45,7 @@ const OrderDetails = () => {
}, },
}) // Adjust API endpoint as needed }) // Adjust API endpoint as needed
setOrder(response.data.singleOrder) setOrder(response.data.singleOrder)
console.log(response)
setLoading(false) setLoading(false)
} catch (err) { } catch (err) {
setError(err.return_msg) setError(err.return_msg)
@ -80,7 +79,6 @@ const OrderDetails = () => {
grandTotal, grandTotal,
statusHistory, // Assume this is an array of status objects statusHistory, // Assume this is an array of status objects
} = order } = order
console.log(statusHistory)
return ( return (
<Box> <Box>

View File

@ -46,7 +46,7 @@ const Kyc = () => {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
}) })
console.log(response)
setRows(response.data) setRows(response.data)
} catch (error) { } catch (error) {
console.error('Error fetching data: ', error) console.error('Error fetching data: ', error)
@ -94,7 +94,7 @@ const Kyc = () => {
const handleApproveConfirm = async () => { const handleApproveConfirm = async () => {
try { try {
setLoading(true) setLoading(true)
console.log(selectedRowId2)
await Axios.patch( await Axios.patch(
`/api/kyc/update/${selectedRowId2}`, `/api/kyc/update/${selectedRowId2}`,
{ {

View File

@ -42,7 +42,7 @@ const KycDetails = () => {
'Content-Type': 'multipart/formdata', 'Content-Type': 'multipart/formdata',
}, },
}) })
console.log(response.data)
setRetailerDetails(response.data) setRetailerDetails(response.data)
} catch (error) { } catch (error) {
console.error('Error fetching data: ', error) console.error('Error fetching data: ', error)
@ -60,7 +60,7 @@ const KycDetails = () => {
{ {
rejectionReason: msg, rejectionReason: msg,
user: 'Principal Distributer', // Replace with actual user type user: 'Principal Distributer',
}, },
{ {
headers: { headers: {
@ -135,6 +135,7 @@ const KycDetails = () => {
}, },
}, },
) )
// navigate('/kyc')
setRetailerDetails(res.data.kyc) setRetailerDetails(res.data.kyc)
Swal.fire('Success', 'Approved', 'success') Swal.fire('Success', 'Approved', 'success')
handleModalClose() handleModalClose()
@ -166,7 +167,7 @@ const KycDetails = () => {
const handleImageClick = (url) => { const handleImageClick = (url) => {
setSelectedImageUrl(url) setSelectedImageUrl(url)
console.log(selectedImageUrl)
setOpenImageModal(true) setOpenImageModal(true)
} }
@ -313,10 +314,10 @@ const KycDetails = () => {
: 'Territory Manager'} : 'Territory Manager'}
</Typography> </Typography>
<Typography> <Typography>
<strong>Name:</strong> {retailerDetails.addedBy.name} <strong>Name:</strong> {retailerDetails?.addedBy?.name}
</Typography> </Typography>
<Typography> <Typography>
<strong>Employee ID:</strong> {retailerDetails.addedBy.uniqueId} <strong>Employee ID:</strong> {retailerDetails?.addedBy?.uniqueId}
</Typography> </Typography>
</Grid> </Grid>
<Grid item xs={6}> <Grid item xs={6}>

View File

@ -111,7 +111,6 @@ const Cart = () => {
const cartSubtotal = useSelector(selectCartSubtotal) const cartSubtotal = useSelector(selectCartSubtotal)
const [value, setValue] = useState(0) const [value, setValue] = useState(0)
const handleTabChange = (event, newValue) => { const handleTabChange = (event, newValue) => {
console.log(newValue)
if (value === 3 && newValue !== 3) { if (value === 3 && newValue !== 3) {
setPaymentMode('') setPaymentMode('')
setBillTo('') setBillTo('')

View File

@ -65,11 +65,10 @@ const ReviewOrder = ({
}, },
}, },
) )
console.log(res)
if (res.status === 201) { if (res.status === 201) {
setOrderId(res?.data?.placedOrder?.uniqueId) setOrderId(res?.data?.placedOrder?.uniqueId)
console.log(res)
Swal.fire('Success!', 'Your order has been placed successfully.', 'success') Swal.fire('Success!', 'Your order has been placed successfully.', 'success')
handleTabChange(e, 3) handleTabChange(e, 3)
} }
@ -77,7 +76,7 @@ const ReviewOrder = ({
Swal.fire('Something went wrong', error.message, 'error') Swal.fire('Something went wrong', error.message, 'error')
} }
} }
console.log('cartitems', cartItem)
return ( return (
<Box> <Box>
<Box sx={{ my: '2rem', background: '#fff', padding: '1rem', borderRadius: '0.8rem' }}> <Box sx={{ my: '2rem', background: '#fff', padding: '1rem', borderRadius: '0.8rem' }}>

View File

@ -32,7 +32,7 @@ const ShoppingCart = ({ handleTabChange }) => {
// Fetching cart items and subtotal from the Redux store // Fetching cart items and subtotal from the Redux store
const cartItems = useSelector(selectCartItems) const cartItems = useSelector(selectCartItems)
const subtotal = useSelector(selectCartSubtotal) const subtotal = useSelector(selectCartSubtotal)
console.log(cartItems)
// Calculate total GST for the entire cart // Calculate total GST for the entire cart
const totalGST = cartItems.reduce((acc, item) => { const totalGST = cartItems.reduce((acc, item) => {
// console.log(item) // console.log(item)

View File

@ -30,7 +30,7 @@ const ForgetPassword = () => {
e.preventDefault() e.preventDefault()
try { try {
const res = await Axios.post('/api/v1/user/password/forgot', { email }) const res = await Axios.post('/api/v1/user/password/forgot', { email })
console.log(res)
if (res?.status === 200) { if (res?.status === 200) {
Swal.fire('success', res?.data?.message, 'success') Swal.fire('success', res?.data?.message, 'success')
navigate('/login') navigate('/login')

View File

@ -97,7 +97,7 @@ const MyProfile = () => {
}) })
} }
} }
console.log(ownerDetails)
const handleCancle = () => { const handleCancle = () => {
Navigate('/dashboard') Navigate('/dashboard')
} }