Skip to content

Commit

Permalink
fix: resolve validation issue idurar#1202
Browse files Browse the repository at this point in the history
  • Loading branch information
dhuruvandb committed Dec 16, 2024
1 parent ce83ef7 commit 395fe77
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#DATABASE = "mongodb://localhost:27017"
DATABASE = "mongodb+srv://dbdhuruvan2000:[email protected]/idurar-erp-crm?retryWrites=true&w=majority"
#RESEND_API = "your resend_api"
#OPENAI_API_KEY = "your open_ai api key"
JWT_SECRET= "your_private_jwt_secret_key"
Expand Down
2 changes: 1 addition & 1 deletion frontend/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# ----> Remove # comment
VITE_FILE_BASE_URL = 'http://localhost:8888/'
VITE_BACKEND_SERVER="http://your_backend_url_server.com/"
VITE_BACKEND_SERVER="http://localhost:8888/"
PROD = false
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export default function AdminForm({ isUpdateForm = false }) {
{
required: true,
},
{
pattern: /^[A-Za-z][A-Za-z'-]+$/,
message: 'Please enter a valid First Name',
}
]}
>
<Input autoComplete="off" />
Expand All @@ -38,6 +42,10 @@ export default function AdminForm({ isUpdateForm = false }) {
{
required: true,
},
{
pattern: /^[A-Za-z][A-Za-z'-]+$/,
message: 'Please enter a valid Last Name',
}
]}
>
<Input autoComplete="off" />
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/modules/ProfileModule/components/UpdateAdmin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ const UpdateAdmin = ({ config }) => {
}, [currentAdmin]);

const handleSubmit = () => {
form.submit();
form
.validateFields()
.then((values) => {
onSubmit(values);
updatePanel.close();
})
.catch((errorInfo) => {
console.log('Form validation failed:', errorInfo);
});
};

const onSubmit = (fieldsValue) => {
Expand Down Expand Up @@ -58,7 +66,6 @@ const UpdateAdmin = ({ config }) => {
key={`${uniqueId()}`}
onClick={() => {
handleSubmit();
updatePanel.close();
}}
type="primary"
icon={<SaveOutlined />}
Expand Down

0 comments on commit 395fe77

Please sign in to comment.