Skip to content

Commit c778681

Browse files
committed
add city when send request
1 parent e94cdf4 commit c778681

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/Components/VendorRequestForm.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ const VendorRequestForm = ({
4040
const toastId = toast.loading("Sending Request");
4141

4242
try {
43-
const res = await requestFn(formData);
43+
const [city, sector] = formData.address.split(",").map((part) => part.trim());
44+
45+
const newAddress = { city, sector };
46+
const updatedFormData = { ...formData, address: newAddress };
47+
const res = await requestFn({ ...formData, address: newAddress });
4448
if (res.error) {
4549
throw new Error(res?.error?.data?.message as string);
4650
}

src/Components/dashboard/RequestTable.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ interface SellerData {
1111
storeName: string;
1212
address: {
1313
city: string;
14+
sector: string
1415
};
1516
TIN: string;
17+
1618
}
1719

1820
interface SellerTableProps {
@@ -164,12 +166,16 @@ const RequestsTable: React.FC<SellerTableProps> = ({
164166
<div className="z-80 fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-800 bg-opacity-50">
165167
<div className="bg-white rounded-lg shadow-lg p-4 max-w-sm w-full">
166168
<h2 className="text-lg font-semibold mb-4">Seller Details</h2>
169+
167170
<p>
168-
<strong>Store Name:</strong> {selectedSeller.storeName}
171+
<strong>Store name:</strong> {selectedSeller.storeName}
169172
</p>
170173
<p>
171174
<strong>City:</strong> {selectedSeller.address.city}
172175
</p>
176+
<p>
177+
<strong>District:</strong> {selectedSeller.address.sector}
178+
</p>
173179
<p>
174180
<strong>TIN:</strong> {selectedSeller.TIN}
175181
</p>

0 commit comments

Comments
 (0)