mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-22 20:01:59 +00:00
Add comment and edit variable name
This commit is contained in:
@@ -2,4 +2,4 @@ export const DASHBOARD: string = '/dashboard';
|
||||
export const USER: string = '/user';
|
||||
export const ROOM: string = '/room';
|
||||
export const OTHER_PATH: string = '*';
|
||||
export const BASE_URL: string = 'https://hotel-management-api.loiphan.com/';
|
||||
export const BASE_URL: string = 'http://localhost:3000/';
|
||||
|
||||
@@ -31,7 +31,7 @@ const UserDialog = forwardRef((props, ref) => {
|
||||
|
||||
return (
|
||||
<Dialog title={'Add user'} onClose={onClose} ref={dialogRef}>
|
||||
<UserForm onClose={onClose!} reload={reload!} onReload={setReload!} />
|
||||
<UserForm onClose={onClose!} reload={reload!} setReload={setReload!} />
|
||||
</Dialog>
|
||||
);
|
||||
}) as React.FC<IDialogProps>;
|
||||
|
||||
@@ -48,10 +48,10 @@ const FormBtn = styled(Button)`
|
||||
interface IUserFormProp {
|
||||
onClose: () => void;
|
||||
reload: boolean;
|
||||
onReload: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
setReload: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
}
|
||||
|
||||
const UserForm = ({ onClose, reload, onReload }: IUserFormProp) => {
|
||||
const UserForm = ({ onClose, reload, setReload }: IUserFormProp) => {
|
||||
const [reset, setReset] = useState(true);
|
||||
|
||||
// Define your state schema
|
||||
@@ -98,7 +98,9 @@ const UserForm = ({ onClose, reload, onReload }: IUserFormProp) => {
|
||||
|
||||
if (response.statusCode === STATUS_CODE.CREATE) {
|
||||
toast.success(ADD_SUCCESS);
|
||||
onReload(!reload);
|
||||
|
||||
// Reload table data
|
||||
setReload(!reload);
|
||||
} else {
|
||||
toast.error(ERROR_MSG(response.statusCode, response.msg));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user