CEC-2075 Remove supplier active directory id (#167)
* CEC-2075 Remove supplier oid * Clean up
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import React, { useContext, useEffect, useState } from "react";
|
import React, { useContext, useEffect, useState } from "react";
|
||||||
import api from "../../services/suppliersAPI";
|
import api from "../../services/suppliersAPI";
|
||||||
|
import { LocalDateTimeString } from "../../utils/dates";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
validateSupplier,
|
validateSupplier,
|
||||||
@@ -12,26 +13,26 @@ const SupplierDetailsContext = React.createContext();
|
|||||||
export const SupplierDetailsProvider = ({ children }) => {
|
export const SupplierDetailsProvider = ({ children }) => {
|
||||||
const { getSuppliers, suppliers } = useSupplierContext();
|
const { getSuppliers, suppliers } = useSupplierContext();
|
||||||
const [busy, setBusy] = useState(false);
|
const [busy, setBusy] = useState(false);
|
||||||
const [id, setID] = useState("");
|
|
||||||
const [contact, setContact] = useState("");
|
const [contact, setContact] = useState("");
|
||||||
const [company, setCompany] = useState("");
|
const [company, setCompany] = useState("");
|
||||||
const [address, setAddress] = useState("");
|
const [address, setAddress] = useState("");
|
||||||
const [phone, setPhone] = useState("");
|
const [phone, setPhone] = useState("");
|
||||||
const [program, setProgram] = useState("");
|
const [program, setProgram] = useState("");
|
||||||
const [ecus, setECUs] = useState("");
|
const [ecus, setECUs] = useState("");
|
||||||
|
const [activated, setActivated] = useState(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!suppliers || suppliers.length === 0) return;
|
if (!suppliers || suppliers.length === 0) return;
|
||||||
|
|
||||||
const supplier = suppliers[0];
|
const supplier = suppliers[0];
|
||||||
|
|
||||||
setID(supplier?.id || "");
|
|
||||||
setContact(supplier?.contact || "");
|
setContact(supplier?.contact || "");
|
||||||
setCompany(supplier?.company || "");
|
setCompany(supplier?.company || "");
|
||||||
setAddress(supplier?.address || "");
|
setAddress(supplier?.address || "");
|
||||||
setPhone(supplier?.telephone || "");
|
setPhone(supplier?.telephone || "");
|
||||||
setProgram(supplier?.program || "");
|
setProgram(supplier?.program || "");
|
||||||
setECUs(supplier?.ecus.join(",") || "");
|
setECUs(supplier?.ecus.join(",") || "");
|
||||||
|
setActivated(LocalDateTimeString(supplier?.activated));
|
||||||
}, [suppliers]);
|
}, [suppliers]);
|
||||||
|
|
||||||
const getSupplier = async (email, token) => {
|
const getSupplier = async (email, token) => {
|
||||||
@@ -55,7 +56,6 @@ export const SupplierDetailsProvider = ({ children }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const formData = (email) => ({
|
const formData = (email) => ({
|
||||||
id,
|
|
||||||
contact,
|
contact,
|
||||||
company,
|
company,
|
||||||
address,
|
address,
|
||||||
@@ -65,6 +65,25 @@ export const SupplierDetailsProvider = ({ children }) => {
|
|||||||
ecus: getECUs(),
|
ecus: getECUs(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const activateSupplier = async (email, token) => {
|
||||||
|
try {
|
||||||
|
setBusy(true);
|
||||||
|
validateEmail(email);
|
||||||
|
|
||||||
|
const result = await api.activateSupplier(email, token);
|
||||||
|
if (result.error)
|
||||||
|
throw new Error(`Activate supplier error. ${result.message}`);
|
||||||
|
|
||||||
|
setActivated(
|
||||||
|
LocalDateTimeString(result.activate) || new Date().toDateString()
|
||||||
|
);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} finally {
|
||||||
|
setBusy(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const updateSupplier = async (email, token) => {
|
const updateSupplier = async (email, token) => {
|
||||||
try {
|
try {
|
||||||
const supplier = formData(email);
|
const supplier = formData(email);
|
||||||
@@ -80,14 +99,15 @@ export const SupplierDetailsProvider = ({ children }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteSupplier = async (vin, token) => {
|
const deleteSupplier = async (email, token) => {
|
||||||
try {
|
try {
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
validateEmail(vin);
|
validateEmail(email);
|
||||||
|
|
||||||
const result = await api.deleteSupplier(vin, token);
|
const result = await api.deleteSupplier(email, token);
|
||||||
if (result.error)
|
if (result.error)
|
||||||
throw new Error(`Delete supplier error. ${result.message}`);
|
throw new Error(`Delete supplier error. ${result.message}`);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} finally {
|
} finally {
|
||||||
setBusy(false);
|
setBusy(false);
|
||||||
@@ -97,18 +117,18 @@ export const SupplierDetailsProvider = ({ children }) => {
|
|||||||
return (
|
return (
|
||||||
<SupplierDetailsContext.Provider
|
<SupplierDetailsContext.Provider
|
||||||
value={{
|
value={{
|
||||||
|
activated,
|
||||||
busy,
|
busy,
|
||||||
id,
|
|
||||||
contact,
|
contact,
|
||||||
company,
|
company,
|
||||||
address,
|
address,
|
||||||
phone,
|
phone,
|
||||||
program,
|
program,
|
||||||
ecus,
|
ecus,
|
||||||
|
activateSupplier,
|
||||||
deleteSupplier,
|
deleteSupplier,
|
||||||
getSupplier,
|
getSupplier,
|
||||||
updateSupplier,
|
updateSupplier,
|
||||||
setID,
|
|
||||||
setContact,
|
setContact,
|
||||||
setCompany,
|
setCompany,
|
||||||
setAddress,
|
setAddress,
|
||||||
|
|||||||
@@ -19,52 +19,6 @@ exports[`Supplier page Render 1`] = `
|
|||||||
class="makeStyles-form-5"
|
class="makeStyles-form-5"
|
||||||
novalidate=""
|
novalidate=""
|
||||||
>
|
>
|
||||||
<div
|
|
||||||
class="MuiFormControl-root MuiTextField-root MuiFormControl-marginNormal MuiFormControl-fullWidth"
|
|
||||||
>
|
|
||||||
<label
|
|
||||||
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-outlined Mui-required Mui-required"
|
|
||||||
data-shrink="false"
|
|
||||||
for="id"
|
|
||||||
id="id-label"
|
|
||||||
>
|
|
||||||
Active Directory ID
|
|
||||||
<span
|
|
||||||
aria-hidden="true"
|
|
||||||
class="MuiFormLabel-asterisk MuiInputLabel-asterisk"
|
|
||||||
>
|
|
||||||
|
|
||||||
*
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
<div
|
|
||||||
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-fullWidth MuiInputBase-formControl"
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
aria-invalid="false"
|
|
||||||
class="MuiInputBase-input MuiOutlinedInput-input"
|
|
||||||
id="id"
|
|
||||||
maxlength="255"
|
|
||||||
name="id"
|
|
||||||
required=""
|
|
||||||
type="text"
|
|
||||||
value=""
|
|
||||||
/>
|
|
||||||
<fieldset
|
|
||||||
aria-hidden="true"
|
|
||||||
class="PrivateNotchedOutline-root-62 MuiOutlinedInput-notchedOutline"
|
|
||||||
>
|
|
||||||
<legend
|
|
||||||
class="PrivateNotchedOutline-legendLabelled-64"
|
|
||||||
>
|
|
||||||
<span>
|
|
||||||
Active Directory ID
|
|
||||||
*
|
|
||||||
</span>
|
|
||||||
</legend>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
class="MuiFormControl-root MuiTextField-root MuiFormControl-marginNormal MuiFormControl-fullWidth"
|
class="MuiFormControl-root MuiTextField-root MuiFormControl-marginNormal MuiFormControl-fullWidth"
|
||||||
>
|
>
|
||||||
@@ -341,6 +295,20 @@ exports[`Supplier page Render 1`] = `
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<button
|
||||||
|
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedSecondary MuiButton-fullWidth"
|
||||||
|
tabindex="0"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="MuiButton-label"
|
||||||
|
>
|
||||||
|
Activate
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="MuiTouchRipple-root"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth"
|
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-6 MuiButton-containedPrimary MuiButton-fullWidth"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const Main = () => {
|
|||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const {
|
const {
|
||||||
busy,
|
busy,
|
||||||
id,
|
activated,
|
||||||
contact,
|
contact,
|
||||||
company,
|
company,
|
||||||
address,
|
address,
|
||||||
@@ -23,13 +23,13 @@ const Main = () => {
|
|||||||
program,
|
program,
|
||||||
ecus,
|
ecus,
|
||||||
getSupplier,
|
getSupplier,
|
||||||
setID,
|
|
||||||
setContact,
|
setContact,
|
||||||
setCompany,
|
setCompany,
|
||||||
setAddress,
|
setAddress,
|
||||||
setPhone,
|
setPhone,
|
||||||
setProgram,
|
setProgram,
|
||||||
setECUs,
|
setECUs,
|
||||||
|
activateSupplier,
|
||||||
updateSupplier,
|
updateSupplier,
|
||||||
} = useSupplierDetailsContext();
|
} = useSupplierDetailsContext();
|
||||||
const { setTitle, setSitePath, setMessage } = useStatusContext();
|
const { setTitle, setSitePath, setMessage } = useStatusContext();
|
||||||
@@ -49,6 +49,16 @@ const Main = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const activate = async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
try {
|
||||||
|
await activateSupplier(email, token);
|
||||||
|
setMessage(`Activated ${email}`);
|
||||||
|
} catch (e) {
|
||||||
|
setMessage(e.message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTitle(`Supplier ${email}`);
|
setTitle(`Supplier ${email}`);
|
||||||
setSitePath([
|
setSitePath([
|
||||||
@@ -74,20 +84,6 @@ const Main = () => {
|
|||||||
return (
|
return (
|
||||||
<div className={classes.paper}>
|
<div className={classes.paper}>
|
||||||
<form className={classes.form} noValidate action="#">
|
<form className={classes.form} noValidate action="#">
|
||||||
<TextField
|
|
||||||
id="id"
|
|
||||||
name="id"
|
|
||||||
label="Active Directory ID"
|
|
||||||
variant="outlined"
|
|
||||||
margin="normal"
|
|
||||||
inputProps={{
|
|
||||||
maxLength: "255",
|
|
||||||
}}
|
|
||||||
required
|
|
||||||
fullWidth
|
|
||||||
value={id}
|
|
||||||
onChange={(e) => setID(e.target.value)}
|
|
||||||
/>
|
|
||||||
<TextField
|
<TextField
|
||||||
id="contact"
|
id="contact"
|
||||||
name="contact"
|
name="contact"
|
||||||
@@ -172,6 +168,33 @@ const Main = () => {
|
|||||||
value={ecus}
|
value={ecus}
|
||||||
onChange={(e) => setECUs(e.target.value)}
|
onChange={(e) => setECUs(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
{activated ? (
|
||||||
|
<TextField
|
||||||
|
id="activated"
|
||||||
|
name="activated"
|
||||||
|
label="Activated"
|
||||||
|
variant="outlined"
|
||||||
|
margin="normal"
|
||||||
|
inputProps={{
|
||||||
|
maxLength: "255",
|
||||||
|
readOnly: true,
|
||||||
|
}}
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
value={activated}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Button
|
||||||
|
disabled={busy}
|
||||||
|
fullWidth
|
||||||
|
variant="contained"
|
||||||
|
color="secondary"
|
||||||
|
className={classes.submit}
|
||||||
|
onClick={activate}
|
||||||
|
>
|
||||||
|
Activate
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
|
|||||||
@@ -23,29 +23,6 @@ exports[`Suppliers page Render 1`] = `
|
|||||||
<tr
|
<tr
|
||||||
class="MuiTableRow-root MuiTableRow-head"
|
class="MuiTableRow-root MuiTableRow-head"
|
||||||
>
|
>
|
||||||
<th
|
|
||||||
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
|
|
||||||
scope="col"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-disabled="false"
|
|
||||||
class="MuiButtonBase-root MuiTableSortLabel-root"
|
|
||||||
role="button"
|
|
||||||
tabindex="0"
|
|
||||||
>
|
|
||||||
ID
|
|
||||||
<svg
|
|
||||||
aria-hidden="true"
|
|
||||||
class="MuiSvgIcon-root MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc"
|
|
||||||
focusable="false"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</span>
|
|
||||||
</th>
|
|
||||||
<th
|
<th
|
||||||
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
|
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
|
||||||
scope="col"
|
scope="col"
|
||||||
@@ -190,6 +167,29 @@ exports[`Suppliers page Render 1`] = `
|
|||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
</th>
|
</th>
|
||||||
|
<th
|
||||||
|
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
|
||||||
|
scope="col"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
aria-disabled="false"
|
||||||
|
class="MuiButtonBase-root MuiTableSortLabel-root"
|
||||||
|
role="button"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
Activated
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="MuiSvgIcon-root MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody
|
<tbody
|
||||||
@@ -198,9 +198,6 @@ exports[`Suppliers page Render 1`] = `
|
|||||||
<tr
|
<tr
|
||||||
class="MuiTableRow-root"
|
class="MuiTableRow-root"
|
||||||
>
|
>
|
||||||
<td
|
|
||||||
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
|
||||||
/>
|
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
||||||
>
|
>
|
||||||
@@ -239,13 +236,13 @@ exports[`Suppliers page Render 1`] = `
|
|||||||
>
|
>
|
||||||
7/14/2021 8:09:40 PM
|
7/14/2021 8:09:40 PM
|
||||||
</td>
|
</td>
|
||||||
|
<td
|
||||||
|
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
||||||
|
/>
|
||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="MuiTableRow-root"
|
class="MuiTableRow-root"
|
||||||
>
|
>
|
||||||
<td
|
|
||||||
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
|
||||||
/>
|
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
||||||
>
|
>
|
||||||
@@ -284,13 +281,13 @@ exports[`Suppliers page Render 1`] = `
|
|||||||
>
|
>
|
||||||
7/16/2021 10:09:40 PM
|
7/16/2021 10:09:40 PM
|
||||||
</td>
|
</td>
|
||||||
|
<td
|
||||||
|
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
||||||
|
/>
|
||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="MuiTableRow-root"
|
class="MuiTableRow-root"
|
||||||
>
|
>
|
||||||
<td
|
|
||||||
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
|
||||||
/>
|
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
||||||
>
|
>
|
||||||
@@ -329,6 +326,9 @@ exports[`Suppliers page Render 1`] = `
|
|||||||
>
|
>
|
||||||
7/16/2021 10:09:40 PM
|
7/16/2021 10:09:40 PM
|
||||||
</td>
|
</td>
|
||||||
|
<td
|
||||||
|
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
|
||||||
|
/>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot
|
<tfoot
|
||||||
|
|||||||
@@ -18,10 +18,6 @@ import TableHeaderSortable from "../../Table/HeaderSortable";
|
|||||||
import { logger } from "../../../services/monitoring";
|
import { logger } from "../../../services/monitoring";
|
||||||
|
|
||||||
const tableColumns = [
|
const tableColumns = [
|
||||||
{
|
|
||||||
id: "id",
|
|
||||||
label: "ID",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: "contact",
|
id: "contact",
|
||||||
label: "Contact",
|
label: "Contact",
|
||||||
@@ -46,6 +42,10 @@ const tableColumns = [
|
|||||||
id: "created_at",
|
id: "created_at",
|
||||||
label: "Registered",
|
label: "Registered",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "activated_at",
|
||||||
|
label: "Activated",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const SupplierTable = (props) => {
|
const SupplierTable = (props) => {
|
||||||
@@ -119,7 +119,6 @@ const SupplierTable = (props) => {
|
|||||||
{suppliers.map((row, index) => {
|
{suppliers.map((row, index) => {
|
||||||
return (
|
return (
|
||||||
<TableRow key={index}>
|
<TableRow key={index}>
|
||||||
<TableCell align="center">{row?.id}</TableCell>
|
|
||||||
<TableCell align="center">
|
<TableCell align="center">
|
||||||
<Link to={`/supplier/${row.email}`}>{row.contact}</Link>
|
<Link to={`/supplier/${row.email}`}>{row.contact}</Link>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
@@ -132,6 +131,9 @@ const SupplierTable = (props) => {
|
|||||||
<TableCell align="center">
|
<TableCell align="center">
|
||||||
{LocalDateTimeString(row.created)}
|
{LocalDateTimeString(row.created)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
{LocalDateTimeString(row.activated)}
|
||||||
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ const suppliersAPI = {
|
|||||||
data.push(supplier);
|
data.push(supplier);
|
||||||
return supplier;
|
return supplier;
|
||||||
},
|
},
|
||||||
|
activateSupplier: async (_email, _token) => {
|
||||||
|
return { message: "2022-07-14T21:02:58.998182Z" };
|
||||||
|
},
|
||||||
deleteSupplier: async (email) => {
|
deleteSupplier: async (email) => {
|
||||||
const index = data.findIndex((element) => element.email === email);
|
const index = data.findIndex((element) => element.email === email);
|
||||||
if (index >= 0) data.splice(index, 1);
|
if (index >= 0) data.splice(index, 1);
|
||||||
|
|||||||
@@ -20,6 +20,17 @@ const suppliersAPI = {
|
|||||||
.then(fetchRespHandler)
|
.then(fetchRespHandler)
|
||||||
.catch(errorHandler),
|
.catch(errorHandler),
|
||||||
|
|
||||||
|
activateSupplier: async (email, token) =>
|
||||||
|
fetch(`${API_ENDPOINT}/supplier/activate/${email}`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: Object.assign(
|
||||||
|
{ "Content-Type": "application/json" },
|
||||||
|
getAuthHeaderOptions(token)
|
||||||
|
),
|
||||||
|
})
|
||||||
|
.then(fetchRespHandler)
|
||||||
|
.catch(errorHandler),
|
||||||
|
|
||||||
deleteSupplier: async (email, token) =>
|
deleteSupplier: async (email, token) =>
|
||||||
fetch(`${API_ENDPOINT}/supplier/${email}`, {
|
fetch(`${API_ENDPOINT}/supplier/${email}`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
|
|||||||
@@ -7,10 +7,6 @@ export const validateSupplier = (supplier) => {
|
|||||||
|
|
||||||
validateEmail(supplier.email);
|
validateEmail(supplier.email);
|
||||||
|
|
||||||
if (!supplier?.id) {
|
|
||||||
throw new Error("id required");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!supplier?.contact) {
|
if (!supplier?.contact) {
|
||||||
throw new Error("contact required");
|
throw new Error("contact required");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user