added
This commit is contained in:
parent
6db066687c
commit
6b4e09abe1
@ -1,8 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
|
|
||||||
const AirwaysBill = React.lazy(() => import('./views/AirwaysBill/AirwaysBill'))
|
const AirwaysBill = React.lazy(() => import('./views/AirwaysBill/AirwaysBill'))
|
||||||
const AddAirwaysBill = React.lazy(() => import('./views/AirwaysBill/AddAirwaysBill'))
|
const AddAirwaysBill = React.lazy(() => import('./views/AirwaysBill/AddAirwaysBill'))
|
||||||
|
const AirwayBillDetail = React.lazy(() => import('./views/AirwaysBill/AirwayBillDetail'))
|
||||||
const Courier = React.lazy(() => import('./views/Courier/Courier'))
|
const Courier = React.lazy(() => import('./views/Courier/Courier'))
|
||||||
const EditCourier = React.lazy(() => import('./views/Courier/EditCourier'))
|
const EditCourier = React.lazy(() => import('./views/Courier/EditCourier'))
|
||||||
const AddCourier = React.lazy(() => import('./views/Courier/AddCourier'))
|
const AddCourier = React.lazy(() => import('./views/Courier/AddCourier'))
|
||||||
@ -70,6 +70,7 @@ const routes = [
|
|||||||
{ path: '/addcourier', name: 'Courier / Add Courier', component: AddCourier },
|
{ path: '/addcourier', name: 'Courier / Add Courier', component: AddCourier },
|
||||||
{ path: '/airwaysbill', name: 'Airways Bill', component: AirwaysBill },
|
{ path: '/airwaysbill', name: 'Airways Bill', component: AirwaysBill },
|
||||||
{ path: '/addairwaysbill', name: 'Airways Bill / Add New Entry', component: AddAirwaysBill },
|
{ path: '/addairwaysbill', name: 'Airways Bill / Add New Entry', component: AddAirwaysBill },
|
||||||
|
{ path: '/viewbill/:id', name: 'View Bill', component: AirwayBillDetail }, ,
|
||||||
{ path: '/vendors', name: 'Vendors', component: Vendor },
|
{ path: '/vendors', name: 'Vendors', component: Vendor },
|
||||||
{ path: '/editvendor/:id', name: 'Edit Vendor', component: EditVendor },
|
{ path: '/editvendor/:id', name: 'Edit Vendor', component: EditVendor },
|
||||||
{ path: '/viewvendor/:id', name: 'View Vendor', component: VendorDetail },
|
{ path: '/viewvendor/:id', name: 'View Vendor', component: VendorDetail },
|
||||||
|
@ -18,6 +18,8 @@ import { cil3d, cilAirplaneMode, cilGlobeAlt, cilLocationPin, cilLockLocked, cil
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { isAutheticated } from 'src/auth';
|
import { isAutheticated } from 'src/auth';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
import Swal from 'sweetalert2';
|
||||||
|
|
||||||
|
|
||||||
const AddAirwaysBill = () => {
|
const AddAirwaysBill = () => {
|
||||||
@ -27,17 +29,28 @@ const AddAirwaysBill = () => {
|
|||||||
city: '',
|
city: '',
|
||||||
state: 'Andhra Pradesh',
|
state: 'Andhra Pradesh',
|
||||||
country: 'India',
|
country: 'India',
|
||||||
address_1: '',
|
from_address_1: '',
|
||||||
address_2: '',
|
from_address_2: '',
|
||||||
|
to_address_1: '',
|
||||||
|
to_name: '',
|
||||||
|
to_address_2: '',
|
||||||
|
AWB: '',
|
||||||
|
courier: ''
|
||||||
})
|
})
|
||||||
|
const [showCouriers, setShowCouriers] = useState([])
|
||||||
|
const [showVendors, setShowVendors] = useState([])
|
||||||
const [code, setCode] = useState()
|
const [code, setCode] = useState()
|
||||||
|
const history = useHistory()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const generateCode = () => {
|
const generateCode = () => {
|
||||||
setCode(Math.round(Math.random() * 1000000000))
|
setCode(Math.round(Math.random() * 1000000000))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
const res = await axios.get('/api/vendor/view',
|
|
||||||
|
const couriers = await axios.get('/api/courier',
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
@ -45,11 +58,25 @@ const AddAirwaysBill = () => {
|
|||||||
"Authorization": `Bearer ${token}`
|
"Authorization": `Bearer ${token}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(res.data.Stores);
|
const vendors = await axios.get('/api/vendor/view',
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
"Content-type": "Application/json",
|
||||||
|
"Authorization": `Bearer ${token}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log(couriers.data.Pincode);
|
||||||
|
console.log(vendors.data.Stores);
|
||||||
|
setShowVendors(vendors.data.Stores)
|
||||||
|
setShowCouriers(couriers.data.Pincode)
|
||||||
}
|
}
|
||||||
getData();
|
getData();
|
||||||
generateCode()
|
generateCode()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
const formatDate = () => {
|
const formatDate = () => {
|
||||||
let today = new Date();
|
let today = new Date();
|
||||||
let dd = String(today.getDate()).padStart(2, '0');
|
let dd = String(today.getDate()).padStart(2, '0');
|
||||||
@ -60,6 +87,32 @@ const AddAirwaysBill = () => {
|
|||||||
return today
|
return today
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleChange = (e) => (event) => {
|
||||||
|
setBill({ ...bill, [e]: event.target.value });
|
||||||
|
};
|
||||||
|
const handleClick = async () => {
|
||||||
|
let res = await axios.post('/api/airways/add', { ...bill, code }, {
|
||||||
|
headers: {
|
||||||
|
"Authorization": `Bearer ${token}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if ((res.data.message === "Success")) {
|
||||||
|
console.log(res.data);
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Done',
|
||||||
|
text: 'Bill Added',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'ok',
|
||||||
|
confirmButtonColor: '#303c54',
|
||||||
|
iconColor: '#303c54'
|
||||||
|
}).then(() => {
|
||||||
|
history.push('/airwaysbill')
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal("Oops!", "Something went wrong!", "error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return <div className="bg-light min-vh-100 d-flex flex-row align-items-start">
|
return <div className="bg-light min-vh-100 d-flex flex-row align-items-start">
|
||||||
<CContainer>
|
<CContainer>
|
||||||
<CRow className="justify-content-start">
|
<CRow className="justify-content-start">
|
||||||
@ -69,7 +122,7 @@ const AddAirwaysBill = () => {
|
|||||||
<p className="text-medium-emphasis">Fill the fields and submit to add a new bill</p>
|
<p className="text-medium-emphasis">Fill the fields and submit to add a new bill</p>
|
||||||
<CRow className='flex-row align-items-center'>
|
<CRow className='flex-row align-items-center'>
|
||||||
<CCol md={2} ><h4>ID:</h4></CCol>
|
<CCol md={2} ><h4>ID:</h4></CCol>
|
||||||
<CCol><h6>5324756898</h6></CCol>
|
<CCol><h6>{code}</h6></CCol>
|
||||||
{/* <p className="text-medium-emphasis">(auto-generated)</p> */}
|
{/* <p className="text-medium-emphasis">(auto-generated)</p> */}
|
||||||
</CRow>
|
</CRow>
|
||||||
<CRow className='flex-row align-items-center'>
|
<CRow className='flex-row align-items-center'>
|
||||||
@ -83,13 +136,14 @@ const AddAirwaysBill = () => {
|
|||||||
</CInputGroupText>
|
</CInputGroupText>
|
||||||
<CFormSelect
|
<CFormSelect
|
||||||
aria-label="Default select example"
|
aria-label="Default select example"
|
||||||
options={[
|
onChange={handleChange('vendor_name')}
|
||||||
'Select Vendor',
|
>
|
||||||
{ label: 'One', value: '1' },
|
<option value='India'>Select Vendor</option>{
|
||||||
{ label: 'Two', value: '2' },
|
showVendors.map((item) =>
|
||||||
{ label: 'Three', value: '3', disabled: true }
|
<option value={item.vendor_name}>{item.vendor_name}</option>
|
||||||
]}
|
)
|
||||||
/>
|
}
|
||||||
|
</CFormSelect>
|
||||||
</CInputGroup>
|
</CInputGroup>
|
||||||
<CInputGroup className="mb-3">
|
<CInputGroup className="mb-3">
|
||||||
<CInputGroupText>
|
<CInputGroupText>
|
||||||
@ -98,12 +152,14 @@ const AddAirwaysBill = () => {
|
|||||||
<CFormInput
|
<CFormInput
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Address Line 1"
|
placeholder="Address Line 1"
|
||||||
// autoComplete="address"
|
// autoComplete="address"
|
||||||
|
onChange={handleChange('from_address_1')}
|
||||||
/>
|
/>
|
||||||
<CFormInput
|
<CFormInput
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Address Line 2(area)"
|
placeholder="Address Line 2(area)"
|
||||||
autoComplete="address2"
|
autoComplete="address2"
|
||||||
|
onChange={handleChange('from_address_2')}
|
||||||
/>
|
/>
|
||||||
</CInputGroup>
|
</CInputGroup>
|
||||||
<CInputGroup className="mb-3">
|
<CInputGroup className="mb-3">
|
||||||
@ -114,6 +170,7 @@ const AddAirwaysBill = () => {
|
|||||||
type="text"
|
type="text"
|
||||||
placeholder="To (Name)"
|
placeholder="To (Name)"
|
||||||
autoComplete="toname"
|
autoComplete="toname"
|
||||||
|
onChange={handleChange('to_name')}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</CInputGroup>
|
</CInputGroup>
|
||||||
@ -124,12 +181,14 @@ const AddAirwaysBill = () => {
|
|||||||
<CFormInput
|
<CFormInput
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Address Line 1"
|
placeholder="Address Line 1"
|
||||||
// autoComplete="address"
|
// autoComplete="address"
|
||||||
|
onChange={handleChange('to_address_1')}
|
||||||
/>
|
/>
|
||||||
<CFormInput
|
<CFormInput
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Address Line 2(area)"
|
placeholder="Address Line 2(area)"
|
||||||
autoComplete="address2"
|
autoComplete="address2"
|
||||||
|
onChange={handleChange('to_address_2')}
|
||||||
/>
|
/>
|
||||||
</CInputGroup>
|
</CInputGroup>
|
||||||
<CInputGroup className="mb-3">
|
<CInputGroup className="mb-3">
|
||||||
@ -138,13 +197,15 @@ const AddAirwaysBill = () => {
|
|||||||
</CInputGroupText>
|
</CInputGroupText>
|
||||||
<CFormSelect
|
<CFormSelect
|
||||||
aria-label="Default select example"
|
aria-label="Default select example"
|
||||||
options={[
|
onChange={handleChange('courier')}
|
||||||
'Select Courier',
|
>
|
||||||
{ label: 'One', value: '1' },
|
<option value='India'>Select Courier</option>{
|
||||||
{ label: 'Two', value: '2' },
|
showCouriers.map((item) =>
|
||||||
{ label: 'Three', value: '3', disabled: true }
|
<option value={item._id}>{item.name}</option>
|
||||||
]}
|
)
|
||||||
/></CInputGroup>
|
}
|
||||||
|
</CFormSelect>
|
||||||
|
</CInputGroup>
|
||||||
<CInputGroup className="mb-3">
|
<CInputGroup className="mb-3">
|
||||||
<CInputGroupText>
|
<CInputGroupText>
|
||||||
<CIcon icon={cilAirplaneMode} />
|
<CIcon icon={cilAirplaneMode} />
|
||||||
@ -153,9 +214,10 @@ const AddAirwaysBill = () => {
|
|||||||
type="text"
|
type="text"
|
||||||
placeholder="AWB"
|
placeholder="AWB"
|
||||||
autoComplete="AWB"
|
autoComplete="AWB"
|
||||||
|
onChange={handleChange('AWB')}
|
||||||
/>
|
/>
|
||||||
</CInputGroup>
|
</CInputGroup>
|
||||||
<CButton color="dark" className="px-4">
|
<CButton color="dark" className="px-4" onClick={() => handleClick()}>
|
||||||
Submit
|
Submit
|
||||||
</CButton>
|
</CButton>
|
||||||
|
|
||||||
|
88
src/views/AirwaysBill/AirwayBillDetail.js
Normal file
88
src/views/AirwaysBill/AirwayBillDetail.js
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import {
|
||||||
|
CTable,
|
||||||
|
CTableBody,
|
||||||
|
CTableDataCell,
|
||||||
|
CTableHead,
|
||||||
|
CTableHeaderCell,
|
||||||
|
CTableRow,
|
||||||
|
} from '@coreui/react'
|
||||||
|
import { useParams } from 'react-router-dom';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { isAutheticated } from '../../auth';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const AirwayBillDetail = () => {
|
||||||
|
const [data, setData] = useState({});
|
||||||
|
const { id } = useParams()
|
||||||
|
const { token } = isAutheticated();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const getData = async () => {
|
||||||
|
const res = await axios.get(`/api/airways/view/${id}`, {
|
||||||
|
headers: {
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
"Content-type": "Application/json",
|
||||||
|
"Authorization": `Bearer ${token}`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (res) {
|
||||||
|
setData(res?.data?.Store)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
getData();
|
||||||
|
}, []);
|
||||||
|
console.log(data);
|
||||||
|
const formatDate = (date) => {
|
||||||
|
let today = new Date(date);
|
||||||
|
let dd = String(today.getDate()).padStart(2, '0');
|
||||||
|
let mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
|
||||||
|
let yyyy = today.getFullYear();
|
||||||
|
|
||||||
|
today = dd + '/' + mm + '/' + yyyy;
|
||||||
|
return today
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return <div >
|
||||||
|
<h1>Bill Details</h1>
|
||||||
|
<CTable color="dark" striped>
|
||||||
|
<CTableHead>
|
||||||
|
<CTableRow>
|
||||||
|
<CTableHeaderCell scope="col">Unique ID</CTableHeaderCell>
|
||||||
|
<CTableDataCell scope="col">{data._id}</CTableDataCell>
|
||||||
|
</CTableRow>
|
||||||
|
</CTableHead>
|
||||||
|
<CTableBody>
|
||||||
|
<CTableRow>
|
||||||
|
<CTableHeaderCell scope="col">Code</CTableHeaderCell>
|
||||||
|
<CTableDataCell scope="col">{data.code}</CTableDataCell>
|
||||||
|
</CTableRow>
|
||||||
|
<CTableRow>
|
||||||
|
<CTableHeaderCell scope="col">AWB</CTableHeaderCell>
|
||||||
|
<CTableDataCell scope="col">{data.AWB}</CTableDataCell>
|
||||||
|
</CTableRow>
|
||||||
|
<CTableRow>
|
||||||
|
<CTableHeaderCell scope="row">Vendor Name</CTableHeaderCell>
|
||||||
|
<CTableDataCell>{data.vendor_name}</CTableDataCell>
|
||||||
|
</CTableRow>
|
||||||
|
<CTableRow>
|
||||||
|
<CTableHeaderCell scope="row">Added On</CTableHeaderCell>
|
||||||
|
<CTableDataCell>{formatDate(data.createdAt)}</CTableDataCell>
|
||||||
|
</CTableRow>
|
||||||
|
<CTableRow>
|
||||||
|
<CTableHeaderCell scope="row">From Address</CTableHeaderCell>
|
||||||
|
<CTableDataCell>{data.from_address_1},{data.from_address_2},{data.city},{data.state},{data.country}</CTableDataCell>
|
||||||
|
</CTableRow>
|
||||||
|
<CTableRow>
|
||||||
|
<CTableHeaderCell scope="row">To Address</CTableHeaderCell>
|
||||||
|
<CTableDataCell>{data.to_address_1},{data.to_address_2}</CTableDataCell>
|
||||||
|
</CTableRow>
|
||||||
|
</CTableBody>
|
||||||
|
</CTable>
|
||||||
|
</div>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AirwayBillDetail;
|
@ -24,11 +24,11 @@ import axios from 'axios';
|
|||||||
|
|
||||||
const AirwaysBill = () => {
|
const AirwaysBill = () => {
|
||||||
const { token } = isAutheticated();
|
const { token } = isAutheticated();
|
||||||
console.log(token);
|
const [data, setData] = useState([])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
const res = await axios.get('/api/vendor/view', {
|
const res = await axios.get('/api/airways/view', {
|
||||||
headers: {
|
headers: {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
"Content-type": "Application/json",
|
"Content-type": "Application/json",
|
||||||
@ -36,10 +36,20 @@ const AirwaysBill = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
|
setData(res.data.Stores)
|
||||||
}
|
}
|
||||||
getData();
|
getData();
|
||||||
|
|
||||||
}, []);
|
}, []);
|
||||||
|
const formatDate = (date) => {
|
||||||
|
let today = new Date(date);
|
||||||
|
let dd = String(today.getDate()).padStart(2, '0');
|
||||||
|
let mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
|
||||||
|
let yyyy = today.getFullYear();
|
||||||
|
|
||||||
|
today = dd + '/' + mm + '/' + yyyy;
|
||||||
|
return today
|
||||||
|
}
|
||||||
|
|
||||||
return <div>
|
return <div>
|
||||||
|
|
||||||
@ -59,21 +69,25 @@ const AirwaysBill = () => {
|
|||||||
<CTableHeaderCell scope="col">Action</CTableHeaderCell>
|
<CTableHeaderCell scope="col">Action</CTableHeaderCell>
|
||||||
</CTableRow>
|
</CTableRow>
|
||||||
</CTableHead>
|
</CTableHead>
|
||||||
<CTableBody>
|
<tbody>
|
||||||
<CTableRow>
|
{data.map(item =>
|
||||||
<CTableHeaderCell scope="row">Mark</CTableHeaderCell>
|
<tr>
|
||||||
<CTableDataCell>123</CTableDataCell>
|
<td scope="row">{item.code}</td>
|
||||||
<CTableDataCell>Otto</CTableDataCell>
|
<td>{item.vendor_name}</td>
|
||||||
<CTableDataCell>123</CTableDataCell>
|
<td>{formatDate(item.createdAt)}</td>
|
||||||
<CTableDataCell>Otto</CTableDataCell>
|
<td>{item.to_name}</td>
|
||||||
<CTableDataCell>
|
<td>{item.AWB}</td>
|
||||||
<CButtonGroup role="group" aria-label="Basic mixed styles example">
|
<td>
|
||||||
<CButton color="success">View</CButton>
|
<CButtonGroup role="group" aria-label="Basic mixed styles example">
|
||||||
|
<Link to={`/viewbill/${item._id}`}><CButton color="success">View</CButton></Link>
|
||||||
|
|
||||||
</CButtonGroup>
|
</CButtonGroup>
|
||||||
</CTableDataCell>
|
</td>
|
||||||
</CTableRow>
|
</tr>
|
||||||
</CTableBody>
|
|
||||||
|
)}
|
||||||
|
|
||||||
|
</tbody>
|
||||||
</CTable></div>;
|
</CTable></div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import { useHistory } from 'react-router-dom';
|
|||||||
const Courier = () => {
|
const Courier = () => {
|
||||||
const { token } = isAutheticated();
|
const { token } = isAutheticated();
|
||||||
const [data, setData] = useState([])
|
const [data, setData] = useState([])
|
||||||
const history = useHistory()
|
const [reload, setReload] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
@ -37,7 +37,7 @@ const Courier = () => {
|
|||||||
}
|
}
|
||||||
getData();
|
getData();
|
||||||
|
|
||||||
}, []);
|
}, [reload]);
|
||||||
const handleDelete = async (id) => {
|
const handleDelete = async (id) => {
|
||||||
const res = await axios.delete(`/api/courier/${id}`, {
|
const res = await axios.delete(`/api/courier/${id}`, {
|
||||||
headers: {
|
headers: {
|
||||||
@ -56,7 +56,8 @@ const Courier = () => {
|
|||||||
iconColor: '#303c54'
|
iconColor: '#303c54'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
// history.push('/courier');
|
// history.push('/courier');
|
||||||
location.reload();
|
// location.reload();
|
||||||
|
setReload(!reload)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Swal("Oops!", "Something went wrong!", "error");
|
Swal("Oops!", "Something went wrong!", "error");
|
||||||
|
2
src/views/Vendor/AddVendor.js
vendored
2
src/views/Vendor/AddVendor.js
vendored
@ -82,7 +82,7 @@ const AddVendor = () => {
|
|||||||
confirmButtonColor: '#303c54',
|
confirmButtonColor: '#303c54',
|
||||||
iconColor: '#303c54'
|
iconColor: '#303c54'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
history.push('/courier');
|
history.push('/vendors');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Swal("Oops!", "Something went wrong!", "error");
|
Swal("Oops!", "Something went wrong!", "error");
|
||||||
|
10
src/views/Vendor/Vendor.js
vendored
10
src/views/Vendor/Vendor.js
vendored
@ -21,6 +21,7 @@ const Vendor = () => {
|
|||||||
const { token } = isAutheticated();
|
const { token } = isAutheticated();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const [data, setData] = useState([]);
|
const [data, setData] = useState([]);
|
||||||
|
const [reload, setReload] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
@ -36,12 +37,12 @@ const Vendor = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
console.log(res.data);
|
|
||||||
}
|
}
|
||||||
getData();
|
getData();
|
||||||
data.map(item => console.log(item.city))
|
|
||||||
|
|
||||||
}, []);
|
|
||||||
|
}, [reload]);
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
const handleDelete = async (id) => {
|
const handleDelete = async (id) => {
|
||||||
@ -62,7 +63,8 @@ const Vendor = () => {
|
|||||||
iconColor: '#303c54'
|
iconColor: '#303c54'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
// history.('/vendors');
|
// history.('/vendors');
|
||||||
location.reload();
|
setReload(!reload)
|
||||||
|
// location.reload();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Swal("Oops!", "Something went wrong!", "error");
|
Swal("Oops!", "Something went wrong!", "error");
|
||||||
|
Loading…
Reference in New Issue
Block a user