machinary implement

This commit is contained in:
2023-07-16 15:16:31 +03:30
parent 632f009f2c
commit 29d031a83e
6 changed files with 129 additions and 42 deletions

View File

@@ -44,9 +44,9 @@ const useDataTable = () => {
const { token } = useUser();
const confirmData = useCallback(async (url, rowID, values) => {
dispatch({ type: "CONFIRM_DATA", url: url, rowID: rowID });
dispatch({ type: "CONFIRM_DATA", url: url, rowID: rowID, values: values });
axios
.post(`${url}/${rowID}`, null, {
.post(`${url}/${rowID}`, values, {
headers: { authorization: `Bearer ${token}` },
})
.then(() => {
@@ -60,13 +60,14 @@ const useDataTable = () => {
const rejectData = useCallback(async (url, rowID, values) => {
dispatch({ type: "REJECT_DATA", url: url, rowID: rowID, values: values });
axios
.post(`${url}/${rowID}`,values, {
.post(`${url}/${rowID}`, values, {
headers: { authorization: `Bearer ${token}` },
})
.then(() => {
setReloadDataTable(true);
})
.catch((error) => {
console.log(error);
Notifications(directionApp, error.response, t);
});
}, []);