LFFE-2 update table component and remove fetchurl from every where in usage of mutate
This commit is contained in:
@@ -1,13 +1,24 @@
|
||||
import { UPDATE_LOAN_MANAGEMENT_NAVGAN } from "@/core/data/apiRoutes";
|
||||
import {UPDATE_LOAN_MANAGEMENT_NAVGAN} from "@/core/data/apiRoutes";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useLoanStateNavgan from "@/lib/prefetchDataTable/hooks/useLoanStateNavgan";
|
||||
import { Button, DialogActions, DialogContent, FormControl, FormHelperText, InputLabel, MenuItem, Select, Stack, TextField } from "@mui/material"
|
||||
import { useFormik } from "formik";
|
||||
import { useTranslations } from "next-intl";
|
||||
import {
|
||||
Button,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
FormControl,
|
||||
FormHelperText,
|
||||
InputLabel,
|
||||
MenuItem,
|
||||
Select,
|
||||
Stack,
|
||||
TextField
|
||||
} from "@mui/material"
|
||||
import {useFormik} from "formik";
|
||||
import {useTranslations} from "next-intl";
|
||||
import * as Yup from "yup";
|
||||
|
||||
const UpdateContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const UpdateContent = ({rowId, mutate, setOpenConfirmDialog}) => {
|
||||
const t = useTranslations();
|
||||
const {loan_state_navgan} = useLoanStateNavgan()
|
||||
const requestServer = useRequest({auth: true})
|
||||
@@ -32,7 +43,7 @@ const UpdateContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
requestServer(`${UPDATE_LOAN_MANAGEMENT_NAVGAN}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
mutate()
|
||||
update_notification()
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -47,7 +58,7 @@ const UpdateContent = ({rowId, fetchUrl, mutate, setOpenConfirmDialog}) => {
|
||||
const handleNextStateIDChange = (event) => {
|
||||
formik.setFieldValue("next_state_id", event.target.value)
|
||||
};
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
|
||||
Reference in New Issue
Block a user