Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jay Mehta
/
zango-frontend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Registry
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 6892cb29
authored
2024-06-24 12:25:55 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
contact-us
1 parent
5e8dfe8d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
components/contact-us/GetinTouch.js
redux/actions/activityAction.js
components/contact-us/GetinTouch.js
View file @
6892cb2
...
...
@@ -6,6 +6,8 @@ import { Formik, Form, Field, ErrorMessage } from "formik";
import
*
as
Yup
from
"yup"
;
import
PhoneInput
from
"react-phone-input-2"
;
import
"react-phone-input-2/lib/style.css"
;
import
axios
from
"axios"
;
import
{
toast
}
from
"react-toastify"
;
const
validationSchema
=
Yup
.
object
().
shape
({
fullName
:
Yup
.
string
().
required
(
"Full name is required"
),
...
...
@@ -44,10 +46,28 @@ const GetinTouch = () => {
message
:
""
}}
validationSchema
=
{
validationSchema
}
onSubmit
=
{(
values
,
{
setSubmitting
})
=>
{
onSubmit
=
{
async
(
values
,
{
setSubmitting
})
=>
{
// Handle form submission here
console
.
log
(
values
);
setSubmitting
(
false
);
const
finalData
=
{
name
:
values
.
fullName
,
email
:
values
.
email
,
number
:
values
.
phone
,
zip
:
values
.
zipCode
,
message
:
values
.
message
};
const
config
=
{
header
:
{
"Content-Type"
:
"application/json"
}
};
const
response
=
await
axios
.
post
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/contact-uses`
,
{
data
:
finalData
},
config
);
if
(
response
.
status
==
200
)
{
toast
.
success
(
"Thank you, we will get back to you shortly."
);
}
console
.
log
(
response
);
}}
>
{({
isSubmitting
,
values
,
handleChange
,
handleBlur
,
touched
,
errors
})
=>
(
...
...
@@ -81,7 +101,7 @@ const GetinTouch = () => {
<
Field
as
=
{
PhoneInput
}
inputClass
=
"form-control"
country
=
{
"
in
"
}
country
=
{
"
us
"
}
name
=
"phone"
placeholder
=
"Enter Your Contact Number"
onChange
=
{
phone
=>
handleChange
({
target
:
{
name
:
"phone"
,
value
:
phone
}
})}
...
...
@@ -115,8 +135,9 @@ const GetinTouch = () => {
/
>
{
touched
.
message
&&
errors
.
message
&&
<
div
className
=
"text-danger"
>
{
errors
.
message
}
<
/div>
}
<
/div
>
{
/* {console.log(errors)} */
}
<
div
className
=
"col-md-12"
>
<
button
className
=
"btn btn-primary"
type
=
"submit"
disabled
=
{
isSubmitting
}
>
<
button
className
=
"btn btn-primary"
type
=
"submit"
disabled
=
{
Object
.
keys
(
errors
).
length
>
0
}
>
Submit
<
/button
>
<
/div
>
...
...
redux/actions/activityAction.js
View file @
6892cb2
...
...
@@ -335,7 +335,7 @@ export const getActivitiesForEndUser = () => async dispatch => {
filters
:
{
approved
:
{
$eq
:
"approved"
}
},
sort
:
[{
createdAt
:
'
de
sc'
}],
sort
:
[{
createdAt
:
'
a
sc'
}],
pagination
:
{
pageSize
:
5
},
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment