Add comment and edit variable name

This commit is contained in:
2023-10-29 13:26:34 +07:00
parent 4f24d9c6e2
commit 190319d7d3
3 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -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/';
+1 -1
View File
@@ -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>;
+5 -3
View File
@@ -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));
}