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
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:
parent
4775e655e2
commit
0677909835
@ -7,10 +7,9 @@ import { jwtDecode } from 'jwt-decode'
|
||||
const isTokenExpired = (token) => {
|
||||
try {
|
||||
const decodedToken = jwtDecode(token)
|
||||
console.log('Decoded Token:', decodedToken) // Debugging
|
||||
|
||||
const currentTime = Date.now() / 1000
|
||||
console.log('Current Time:', currentTime) // Debugging
|
||||
console.log('Token Expiration Time:', decodedToken.exp) // Debugging
|
||||
gging
|
||||
return decodedToken.exp < currentTime
|
||||
} catch (error) {
|
||||
console.error('Error decoding token:', error) // Debugging
|
||||
@ -24,9 +23,8 @@ const ProtectedRoute = ({ element: Element }) => {
|
||||
useEffect(() => {
|
||||
const checkToken = () => {
|
||||
const token = localStorage.getItem('authToken')
|
||||
console.log('Token:', token) // Debugging
|
||||
|
||||
if (!token || isTokenExpired(token)) {
|
||||
console.log('Token is expired or not present, redirecting to login')
|
||||
navigate('/login')
|
||||
} else {
|
||||
console.log('Token is valid')
|
||||
|
@ -26,7 +26,6 @@ const Dashboard = () => {
|
||||
},
|
||||
}) // 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) {
|
||||
|
@ -36,7 +36,6 @@ const OrderDetails = () => {
|
||||
setOwnerDetails({ ...res.data.user })
|
||||
}
|
||||
}
|
||||
console.log('order', order)
|
||||
useEffect(() => {
|
||||
const fetchOrderDetails = async () => {
|
||||
try {
|
||||
@ -46,7 +45,7 @@ const OrderDetails = () => {
|
||||
},
|
||||
}) // Adjust API endpoint as needed
|
||||
setOrder(response.data.singleOrder)
|
||||
console.log(response)
|
||||
|
||||
setLoading(false)
|
||||
} catch (err) {
|
||||
setError(err.return_msg)
|
||||
@ -80,7 +79,6 @@ const OrderDetails = () => {
|
||||
grandTotal,
|
||||
statusHistory, // Assume this is an array of status objects
|
||||
} = order
|
||||
console.log(statusHistory)
|
||||
|
||||
return (
|
||||
<Box>
|
||||
|
@ -46,7 +46,7 @@ const Kyc = () => {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
console.log(response)
|
||||
|
||||
setRows(response.data)
|
||||
} catch (error) {
|
||||
console.error('Error fetching data: ', error)
|
||||
@ -94,7 +94,7 @@ const Kyc = () => {
|
||||
const handleApproveConfirm = async () => {
|
||||
try {
|
||||
setLoading(true)
|
||||
console.log(selectedRowId2)
|
||||
|
||||
await Axios.patch(
|
||||
`/api/kyc/update/${selectedRowId2}`,
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ const KycDetails = () => {
|
||||
'Content-Type': 'multipart/formdata',
|
||||
},
|
||||
})
|
||||
console.log(response.data)
|
||||
|
||||
setRetailerDetails(response.data)
|
||||
} catch (error) {
|
||||
console.error('Error fetching data: ', error)
|
||||
@ -60,7 +60,7 @@ const KycDetails = () => {
|
||||
{
|
||||
rejectionReason: msg,
|
||||
|
||||
user: 'Principal Distributer', // Replace with actual user type
|
||||
user: 'Principal Distributer',
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
@ -135,6 +135,7 @@ const KycDetails = () => {
|
||||
},
|
||||
},
|
||||
)
|
||||
// navigate('/kyc')
|
||||
setRetailerDetails(res.data.kyc)
|
||||
Swal.fire('Success', 'Approved', 'success')
|
||||
handleModalClose()
|
||||
@ -166,7 +167,7 @@ const KycDetails = () => {
|
||||
|
||||
const handleImageClick = (url) => {
|
||||
setSelectedImageUrl(url)
|
||||
console.log(selectedImageUrl)
|
||||
|
||||
setOpenImageModal(true)
|
||||
}
|
||||
|
||||
@ -313,10 +314,10 @@ const KycDetails = () => {
|
||||
: 'Territory Manager'}
|
||||
</Typography>
|
||||
<Typography>
|
||||
<strong>Name:</strong> {retailerDetails.addedBy.name}
|
||||
<strong>Name:</strong> {retailerDetails?.addedBy?.name}
|
||||
</Typography>
|
||||
<Typography>
|
||||
<strong>Employee ID:</strong> {retailerDetails.addedBy.uniqueId}
|
||||
<strong>Employee ID:</strong> {retailerDetails?.addedBy?.uniqueId}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
|
@ -111,7 +111,6 @@ const Cart = () => {
|
||||
const cartSubtotal = useSelector(selectCartSubtotal)
|
||||
const [value, setValue] = useState(0)
|
||||
const handleTabChange = (event, newValue) => {
|
||||
console.log(newValue)
|
||||
if (value === 3 && newValue !== 3) {
|
||||
setPaymentMode('')
|
||||
setBillTo('')
|
||||
|
@ -65,11 +65,10 @@ const ReviewOrder = ({
|
||||
},
|
||||
},
|
||||
)
|
||||
console.log(res)
|
||||
|
||||
if (res.status === 201) {
|
||||
setOrderId(res?.data?.placedOrder?.uniqueId)
|
||||
|
||||
console.log(res)
|
||||
Swal.fire('Success!', 'Your order has been placed successfully.', 'success')
|
||||
handleTabChange(e, 3)
|
||||
}
|
||||
@ -77,7 +76,7 @@ const ReviewOrder = ({
|
||||
Swal.fire('Something went wrong', error.message, 'error')
|
||||
}
|
||||
}
|
||||
console.log('cartitems', cartItem)
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Box sx={{ my: '2rem', background: '#fff', padding: '1rem', borderRadius: '0.8rem' }}>
|
||||
|
@ -32,7 +32,7 @@ const ShoppingCart = ({ handleTabChange }) => {
|
||||
// Fetching cart items and subtotal from the Redux store
|
||||
const cartItems = useSelector(selectCartItems)
|
||||
const subtotal = useSelector(selectCartSubtotal)
|
||||
console.log(cartItems)
|
||||
|
||||
// Calculate total GST for the entire cart
|
||||
const totalGST = cartItems.reduce((acc, item) => {
|
||||
// console.log(item)
|
||||
|
@ -30,7 +30,7 @@ const ForgetPassword = () => {
|
||||
e.preventDefault()
|
||||
try {
|
||||
const res = await Axios.post('/api/v1/user/password/forgot', { email })
|
||||
console.log(res)
|
||||
|
||||
if (res?.status === 200) {
|
||||
Swal.fire('success', res?.data?.message, 'success')
|
||||
navigate('/login')
|
||||
|
@ -97,7 +97,7 @@ const MyProfile = () => {
|
||||
})
|
||||
}
|
||||
}
|
||||
console.log(ownerDetails)
|
||||
|
||||
const handleCancle = () => {
|
||||
Navigate('/dashboard')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user