update fix create and update provider
This commit is contained in:
@ -3,7 +3,7 @@ import { useManageProviderContext } from '../hooks/useManageProviderContext';
|
||||
import { Alert, useDataGrid } from '@/components';
|
||||
import { useCallApi } from '@/hooks';
|
||||
import { getAuth } from '@/auth';
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import {
|
||||
Dialog,
|
||||
@ -35,8 +35,8 @@ const EditDialog = () => {
|
||||
status: '',
|
||||
transactionTypeId: '',
|
||||
agentId: '',
|
||||
created_by: '',
|
||||
created_at: ''
|
||||
updated_by: '',
|
||||
updated_at: ''
|
||||
};
|
||||
const [formField, setFormField] = useState(initialState);
|
||||
|
||||
@ -79,16 +79,26 @@ const EditDialog = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
// doUpdateProvider(e);
|
||||
doUpdateProvider(e);
|
||||
console.log(formField);
|
||||
setAlert({ show: false, message: '' });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (showEditDialog) {
|
||||
setFormField({
|
||||
...formField,
|
||||
updated_by: parsedUser.username,
|
||||
updated_at: formattedTime
|
||||
});
|
||||
}
|
||||
}, [formattedTime]);
|
||||
|
||||
return (
|
||||
<Dialog open={showEditDialog} onOpenChange={(open) => handleEditDialog(open, null)}>
|
||||
<DialogContent className="container-fixed max-w-[768px] flex flex-col p-5 overflow-hidden">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Provider - Create</DialogTitle>
|
||||
<DialogTitle>Provider - Update</DialogTitle>
|
||||
<DialogDescription></DialogDescription>
|
||||
</DialogHeader>
|
||||
<DialogBody>
|
||||
|
||||
Reference in New Issue
Block a user