Move request demo api to separate market controller
This commit is contained in:
parent
ad449d6e5c
commit
2f09c947a0
@ -7,7 +7,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import showToast from "../../services/toastService";
|
import showToast from "../../services/toastService";
|
||||||
import AuthRepository from "../../repositories/AuthRepository";
|
import AuthRepository from "../../repositories/AuthRepository";
|
||||||
import { MasterRespository } from "../../repositories/MastersRepository";
|
import { MarketRespository } from "../../repositories/MarketRepository";
|
||||||
|
|
||||||
const mobileNumberRegex = /^(?:\d{10}|\d{3}[-\s]?\d{3}[-\s]?\d{4})$/;
|
const mobileNumberRegex = /^(?:\d{10}|\d{3}[-\s]?\d{3}[-\s]?\d{4})$/;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ const RegisterPage = () => {
|
|||||||
|
|
||||||
const onSubmit = async (data) => {
|
const onSubmit = async (data) => {
|
||||||
try {
|
try {
|
||||||
const response = await AuthRepository.requestDemo(data);
|
const response = await MarketRespository.requestDemo(data);
|
||||||
showToast("Your Registration SuccessFully !");
|
showToast("Your Registration SuccessFully !");
|
||||||
setRegristered(true);
|
setRegristered(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -59,12 +59,11 @@ const RegisterPage = () => {
|
|||||||
fetchIndustries();
|
fetchIndustries();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {}, [industries]);
|
||||||
}, [industries]);
|
|
||||||
|
|
||||||
const fetchIndustries = async () => {
|
const fetchIndustries = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await MasterRespository.getIndustries();
|
const response = await MarketRespository.getIndustries();
|
||||||
const industry = response.data;
|
const industry = response.data;
|
||||||
setIndustries(industry);
|
setIndustries(industry);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -73,7 +72,8 @@ const RegisterPage = () => {
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!registered && (<AuthWrapper>
|
{!registered && (
|
||||||
|
<AuthWrapper>
|
||||||
<h4 className="mb-2">Adventure starts here 🚀</h4>
|
<h4 className="mb-2">Adventure starts here 🚀</h4>
|
||||||
<p className="mb-3">Make your app management easy and fun!</p>
|
<p className="mb-3">Make your app management easy and fun!</p>
|
||||||
|
|
||||||
@ -237,9 +237,7 @@ const RegisterPage = () => {
|
|||||||
{...register("industryId")}
|
{...register("industryId")}
|
||||||
aria-label="Default select example"
|
aria-label="Default select example"
|
||||||
>
|
>
|
||||||
<option value="">
|
<option value="">Select Industry</option>
|
||||||
Select Industry
|
|
||||||
</option>
|
|
||||||
{industries.length > 0 ? (
|
{industries.length > 0 ? (
|
||||||
industries.map((item) => (
|
industries.map((item) => (
|
||||||
<option value={item.id} key={item.id}>
|
<option value={item.id} key={item.id}>
|
||||||
@ -292,7 +290,10 @@ const RegisterPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<button aria-label="Click me" className="btn btn-primary d-grid w-100">
|
<button
|
||||||
|
aria-label="Click me"
|
||||||
|
className="btn btn-primary d-grid w-100"
|
||||||
|
>
|
||||||
Request Demo
|
Request Demo
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@ -308,8 +309,10 @@ const RegisterPage = () => {
|
|||||||
Back to login
|
Back to login
|
||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
</AuthWrapper>)}
|
</AuthWrapper>
|
||||||
{registered && (<AuthWrapper>
|
)}
|
||||||
|
{registered && (
|
||||||
|
<AuthWrapper>
|
||||||
<h6 className="mb-2">Thank you for contacting us</h6>
|
<h6 className="mb-2">Thank you for contacting us</h6>
|
||||||
<h4 className="mb-3">We will get back to you soon</h4>
|
<h4 className="mb-3">We will get back to you soon</h4>
|
||||||
<Link
|
<Link
|
||||||
@ -320,7 +323,8 @@ const RegisterPage = () => {
|
|||||||
<i className="bx bx-chevron-left scaleX-n1-rtl bx-sm"></i>
|
<i className="bx bx-chevron-left scaleX-n1-rtl bx-sm"></i>
|
||||||
Back to login
|
Back to login
|
||||||
</Link>
|
</Link>
|
||||||
</AuthWrapper>)}
|
</AuthWrapper>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,11 +6,10 @@ const AuthRepository = {
|
|||||||
|
|
||||||
logout: (data) => api.post("/api/auth/logout", data),
|
logout: (data) => api.post("/api/auth/logout", data),
|
||||||
profile: () => api.get(`/api/user/profile`),
|
profile: () => api.get(`/api/user/profile`),
|
||||||
register: ( data ) => api.post( 'api/auth/register', data ),
|
register: (data) => api.post("api/auth/register", data),
|
||||||
resetPassword: ( data ) => api.post( '/api/auth/reset-password', data ),
|
resetPassword: (data) => api.post("/api/auth/reset-password", data),
|
||||||
forgotPassword: (data) => api.post( '/api/auth/forgot-password', data),
|
forgotPassword: (data) => api.post("/api/auth/forgot-password", data),
|
||||||
requestDemo: (data) => api.post('/api/auth/inquiry',data),
|
sendMail: (data) => api.post("/api/auth/sendmail", data),
|
||||||
sendMail:(data)=>api.post("/api/auth/sendmail",data)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AuthRepository;
|
export default AuthRepository;
|
||||||
|
|||||||
6
src/repositories/MarketRepository.jsx
Normal file
6
src/repositories/MarketRepository.jsx
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { api } from "../utils/axiosClient";
|
||||||
|
|
||||||
|
export const MarketRepository = {
|
||||||
|
requestDemo: (data) => api.post("/api/market/inquiry", data),
|
||||||
|
getIndustries: () => api.get("api/market/industries"),
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user