Skip to content

Commit

Permalink
add city when send request
Browse files Browse the repository at this point in the history
  • Loading branch information
sevelinCa committed Jul 26, 2024
1 parent e94cdf4 commit c778681
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Components/VendorRequestForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ const VendorRequestForm = ({
const toastId = toast.loading("Sending Request");

try {
const res = await requestFn(formData);
const [city, sector] = formData.address.split(",").map((part) => part.trim());

const newAddress = { city, sector };
const updatedFormData = { ...formData, address: newAddress };
const res = await requestFn({ ...formData, address: newAddress });
if (res.error) {
throw new Error(res?.error?.data?.message as string);
}
Expand Down
8 changes: 7 additions & 1 deletion src/Components/dashboard/RequestTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ interface SellerData {
storeName: string;
address: {
city: string;
sector: string
};
TIN: string;

}

interface SellerTableProps {
Expand Down Expand Up @@ -164,12 +166,16 @@ const RequestsTable: React.FC<SellerTableProps> = ({
<div className="z-80 fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-800 bg-opacity-50">
<div className="bg-white rounded-lg shadow-lg p-4 max-w-sm w-full">
<h2 className="text-lg font-semibold mb-4">Seller Details</h2>

<p>
<strong>Store Name:</strong> {selectedSeller.storeName}
<strong>Store name:</strong> {selectedSeller.storeName}
</p>
<p>
<strong>City:</strong> {selectedSeller.address.city}
</p>
<p>
<strong>District:</strong> {selectedSeller.address.sector}
</p>
<p>
<strong>TIN:</strong> {selectedSeller.TIN}
</p>
Expand Down

0 comments on commit c778681

Please sign in to comment.