done
This commit is contained in:
parent
5f9f99b7a0
commit
195cdcc6c0
|
@ -4,25 +4,23 @@ import mongoose from "mongoose";
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
|
|
||||||
export const createProperty = async (req, res) => {
|
export const createProperty = async (req, res) => {
|
||||||
const property = req.body;
|
const propertyData = req.body;
|
||||||
function generateRandomNumber() {
|
// console.log('Property received:', propertyData);
|
||||||
return Math.floor(Math.random() * 90000) + 10000;
|
|
||||||
}
|
const newProperty = new PropertyModal({
|
||||||
const randomNumber = generateRandomNumber().toString();
|
...propertyData,
|
||||||
const propertyId = `EFP${randomNumber}`;
|
});
|
||||||
const newProperty = new PropertyModal({
|
|
||||||
...property,
|
try {
|
||||||
creator: req.userId,
|
await newProperty.save();
|
||||||
createdAt: new Date().toISOString(),
|
|
||||||
publishedAt: new Date().toISOString(),
|
res.status(201).json(newProperty);
|
||||||
currentYear: new Date().getFullYear(),
|
} catch (error) {
|
||||||
propertyId: propertyId,
|
res.status(404).json({ message: "Something went wrong" });
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
await newProperty.save();
|
|
||||||
res.status(201).json(newProperty);
|
|
||||||
} catch (error) {
|
|
||||||
res.status(404).json({ message: "Something went wrong" });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,12 @@ const secret = process.env.SECRET_KEY
|
||||||
|
|
||||||
const auth = async (req, res, next) => {
|
const auth = async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
// Check if the authorization header exists
|
||||||
|
if (!req.headers.authorization) {
|
||||||
|
return res.status(401).json({ message: "Authorization header missing" });
|
||||||
|
}
|
||||||
|
|
||||||
const token = req.headers.authorization.split(" ")[1];
|
const token = req.headers.authorization.split(" ")[1];
|
||||||
const isCustomAuth = token.length < 500;
|
const isCustomAuth = token.length < 500;
|
||||||
let decodedData;
|
let decodedData;
|
||||||
|
|
|
@ -5,20 +5,7 @@ const propertySchema = mongoose.Schema({
|
||||||
title: {type: String, required: true },
|
title: {type: String, required: true },
|
||||||
yearBuild: {type: String, required: true },
|
yearBuild: {type: String, required: true },
|
||||||
totalSqft: {type: String, required: true },
|
totalSqft: {type: String, required: true },
|
||||||
propertyId: String,
|
|
||||||
creator: String,
|
|
||||||
createdAt: {
|
|
||||||
type: Date,
|
|
||||||
default: new Date(),
|
|
||||||
},
|
|
||||||
publishedAt: {
|
|
||||||
type: Date,
|
|
||||||
default: new Date(),
|
|
||||||
},
|
|
||||||
currentYear: {
|
|
||||||
type: Number,
|
|
||||||
default: new Date().getFullYear(),
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -42,8 +42,8 @@
|
||||||
<!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script> -->
|
<!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script> -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
<script type="module" crossorigin src="/assets/index-BdFlv2f8.js"></script>
|
<script type="module" crossorigin src="/assets/index-CzD7WLXM.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-B4N2BY33.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-BrT2kTNU.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { BrowserRouter, Routes, Route } from "react-router-dom";
|
import { BrowserRouter, Routes, Route } from "react-router-dom";
|
||||||
|
import { ToastContainer } from "react-toastify";
|
||||||
import Home from "./components/Home";
|
import Home from "./components/Home";
|
||||||
import About from "./components/About";
|
import About from "./components/About";
|
||||||
import Contact from "./components/Contact";
|
import Contact from "./components/Contact";
|
||||||
|
@ -10,15 +11,23 @@ import VerifyUser from "./components/EmailVerify";
|
||||||
import ForgotPassword from "./components/ForgotPassword";
|
import ForgotPassword from "./components/ForgotPassword";
|
||||||
import ResetPassword from "./components/ResetPassword";
|
import ResetPassword from "./components/ResetPassword";
|
||||||
import Addproperty from "./components/Addproperty";
|
import Addproperty from "./components/Addproperty";
|
||||||
|
import Registrationsuccess from "./components/Registrationsuccess";
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
return (
|
return (
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
|
<ToastContainer />
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<Home />}></Route>
|
<Route path="/" element={<Home />}></Route>
|
||||||
<Route path="/about" element={<About />}></Route>
|
<Route path="/about" element={<About />}></Route>
|
||||||
<Route path="/contact" element={<Contact/>}></Route>
|
<Route path="/contact" element={<Contact/>}></Route>
|
||||||
<Route path="/register" element={<Register/>}></Route>
|
<Route path="/register" element={<Register/>}></Route>
|
||||||
|
|
||||||
|
<Route path="/registrationsuccess" element={<PrivateRoute><Registrationsuccess/></PrivateRoute>}></Route>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Route path="/login" element={<Login/>}></Route>
|
<Route path="/login" element={<Login/>}></Route>
|
||||||
<Route
|
<Route
|
||||||
path="/dashboard"
|
path="/dashboard"
|
||||||
|
@ -37,7 +46,7 @@ const App = () => {
|
||||||
element={<ResetPassword />}
|
element={<ResetPassword />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route path="/addproperty" element={<Addproperty />}></Route>
|
<Route path="/addproperty" element={ <PrivateRoute><Addproperty /></PrivateRoute>}></Route>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,122 +1,214 @@
|
||||||
import { useState } from "react";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { useDispatch } from "react-redux";
|
import { submitProperty } from "../redux/features/propertySlice";
|
||||||
import { createProperty } from "../redux/features/propertySlice";
|
import { useState, useEffect } from "react";
|
||||||
|
import Navbar from "./Navbar";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
import "react-toastify/dist/ReactToastify.css";
|
||||||
import "../addproperty.css";
|
import "../addproperty.css";
|
||||||
|
|
||||||
const Addproperty = () => {
|
const Addproperty = () => {
|
||||||
|
const [activeTab, setActiveTab] = useState("propertydetails");
|
||||||
|
|
||||||
const [formData, setFormData] = useState({
|
const handleContinue = () => {
|
||||||
propertyType: "",
|
if (activeTab === "propertydetails") setActiveTab("shipping");
|
||||||
title: "",
|
// else if (activeTab === 'shipping') setActiveTab('review');
|
||||||
yearBuild: "",
|
};
|
||||||
totalSqft: "",
|
|
||||||
|
const handleBack = () => {
|
||||||
|
// if (activeTab === 'review') setActiveTab('shipping');
|
||||||
|
// else if (activeTab === 'shipping') setActiveTab('propertydetails');
|
||||||
|
if (activeTab === "shipping") setActiveTab("propertydetails");
|
||||||
|
};
|
||||||
|
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const { status, error } = useSelector((state) => state.property); // Assuming propertySlice handles status and error
|
||||||
|
|
||||||
|
const [formData, setFormData] = useState({
|
||||||
|
propertyType: "",
|
||||||
|
title: "",
|
||||||
|
yearBuild: "",
|
||||||
|
totalSqft: "", // This will now be used in the shipping tab
|
||||||
|
});
|
||||||
|
|
||||||
|
const [submitted, setSubmitted] = useState(false); // Track if the form was submitted
|
||||||
|
|
||||||
|
const handleInputChange = (e) => {
|
||||||
|
setFormData({
|
||||||
|
...formData,
|
||||||
|
[e.target.name]: e.target.value,
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const handleSubmit = () => {
|
||||||
|
if (
|
||||||
|
formData.propertyType &&
|
||||||
|
formData.title &&
|
||||||
|
formData.yearBuild &&
|
||||||
|
formData.totalSqft
|
||||||
|
) {
|
||||||
|
// Dispatch the form data only if all fields are filled
|
||||||
|
dispatch(submitProperty(formData));
|
||||||
|
setSubmitted(true); // Mark the form as submitted
|
||||||
|
} else {
|
||||||
|
toast.error("Please fill all fields before submitting", {
|
||||||
|
position: "top-right",
|
||||||
|
autoClose: 3000,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleInputChange = (e) => {
|
// Show toast after form submission, based on status and error from Redux
|
||||||
setFormData({ ...formData, [e.target.name]: e.target.value });
|
useEffect(() => {
|
||||||
};
|
if (submitted) {
|
||||||
|
if (status === "succeeded") {
|
||||||
|
toast.success("Property submitted successfully!", {
|
||||||
|
position: "top-right",
|
||||||
const handlePlaceOrder = (e) => {
|
autoClose: 3000,
|
||||||
e.preventDefault(); // Prevent form from refreshing the page
|
});
|
||||||
dispatch(createProperty(formData));
|
setSubmitted(false); // Reset after showing toast
|
||||||
};
|
} else if (status === "failed") {
|
||||||
|
toast.error(`Failed to submit: ${error}`, {
|
||||||
return (
|
position: "top-right",
|
||||||
<div className="container tabs-wrap">
|
autoClose: 3000,
|
||||||
|
});
|
||||||
|
setSubmitted(false); // Reset after showing toast
|
||||||
<form onSubmit={handlePlaceOrder}>
|
}
|
||||||
<div className="tab-content">
|
}
|
||||||
|
}, [status, error, submitted]);
|
||||||
<div role="tabpanel" className="tab-pane active">
|
|
||||||
<h3>Submit the Property Details</h3>
|
|
||||||
<br />
|
|
||||||
<div className="row gy-3 overflow-hidden">
|
|
||||||
<div className="col-12">
|
|
||||||
<select
|
|
||||||
className="form-floating mb-3 form-control"
|
|
||||||
name="propertyType"
|
|
||||||
value={formData.propertyType}
|
|
||||||
onChange={handleInputChange}
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<option value="">Please Select Property Type</option>
|
|
||||||
<option value="Residential">Residential</option>
|
|
||||||
<option value="Land">Land</option>
|
|
||||||
<option value="Commercial">Commercial</option>
|
|
||||||
<option value="Industrial">Industrial</option>
|
|
||||||
<option value="Water">Water</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div className="col-12">
|
|
||||||
<div className="form-floating mb-3">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control"
|
|
||||||
name="title"
|
|
||||||
placeholder="Property title"
|
|
||||||
value={formData.title}
|
|
||||||
onChange={handleInputChange}
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
<label htmlFor="title" className="form-label">
|
|
||||||
Property Title
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="col-12">
|
|
||||||
<div className="form-floating mb-3">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control"
|
|
||||||
name="yearBuild"
|
|
||||||
placeholder="Year build"
|
|
||||||
value={formData.yearBuild}
|
|
||||||
onChange={handleInputChange}
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
<label htmlFor="yearBuild" className="form-label">
|
|
||||||
Year Build
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="col-12">
|
|
||||||
<div className="form-floating mb-3">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control"
|
|
||||||
name="totalSqft"
|
|
||||||
placeholder="Total SQFT"
|
|
||||||
value={formData.totalSqft}
|
|
||||||
onChange={handleInputChange}
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
<label htmlFor="totalSqft" className="form-label">
|
|
||||||
Total SQFT
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="btn btn-primary continue"
|
|
||||||
style={{ backgroundColor: "#fda417", border: "#fda417" }}
|
|
||||||
|
|
||||||
>
|
|
||||||
Submit
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="container tabs-wrap">
|
||||||
|
<Navbar />
|
||||||
|
|
||||||
|
<ul className="nav nav-tabs" role="tablist">
|
||||||
|
<li
|
||||||
|
role="presentation"
|
||||||
|
className={activeTab === "propertydetails" ? "active tab" : "tab"}
|
||||||
|
>
|
||||||
|
<a onClick={() => setActiveTab("propertydetails")} role="tab">
|
||||||
|
Property Details
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
role="presentation"
|
||||||
|
className={activeTab === "shipping" ? "active tab" : "tab"}
|
||||||
|
>
|
||||||
|
<a onClick={() => setActiveTab("shipping")} role="tab">
|
||||||
|
Delivery Address
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div className="tab-content">
|
||||||
|
{activeTab === "propertydetails" && (
|
||||||
|
<div role="tabpanel" className="tab-pane active">
|
||||||
|
<h3>Property Details</h3>
|
||||||
|
<form>
|
||||||
|
<div className="row gy-3 overflow-hidden">
|
||||||
|
<div className="col-12">
|
||||||
|
<select
|
||||||
|
className="form-floating mb-3 form-control"
|
||||||
|
name="propertyType"
|
||||||
|
value={formData.propertyType}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<option value="">Please Select Property Type</option>
|
||||||
|
<option value="Residential">Residential</option>
|
||||||
|
<option value="Land">Land</option>
|
||||||
|
<option value="Commercial">Commercial</option>
|
||||||
|
<option value="Industrial">Industrial</option>
|
||||||
|
<option value="Water">Water</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div className="col-12">
|
||||||
|
<div className="form-floating mb-3">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
name="title"
|
||||||
|
value={formData.title}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
placeholder="Property title"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<label htmlFor="title" className="form-label">
|
||||||
|
Property Title
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="col-12">
|
||||||
|
<div className="form-floating mb-3">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
name="yearBuild"
|
||||||
|
value={formData.yearBuild}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
placeholder="Year build"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<label htmlFor="yearBuild" className="form-label">
|
||||||
|
Year Build
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<button
|
||||||
|
className="btn btn-primary continue"
|
||||||
|
onClick={handleContinue}
|
||||||
|
style={{ backgroundColor: "#fda417", border: "#fda417" }}
|
||||||
|
>
|
||||||
|
Continue
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{activeTab === "shipping" && (
|
||||||
|
<div role="tabpanel" className="tab-pane active">
|
||||||
|
<h3>Shipping Address</h3>
|
||||||
|
<form>
|
||||||
|
<div className="row gy-3 overflow-hidden">
|
||||||
|
<div className="col-12">
|
||||||
|
<div className="form-floating mb-3">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
name="totalSqft"
|
||||||
|
value={formData.totalSqft}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
placeholder="Total SQFT"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<label htmlFor="totalSqft" className="form-label">
|
||||||
|
Total SQFT
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<button
|
||||||
|
className="btn btn-primary back"
|
||||||
|
onClick={handleBack}
|
||||||
|
style={{ backgroundColor: "#fda417", border: "#fda417" }}
|
||||||
|
>
|
||||||
|
Go Back
|
||||||
|
</button>{" "}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-primary continue"
|
||||||
|
style={{ backgroundColor: "#fda417", border: "#fda417" }}
|
||||||
|
onClick={handleSubmit}
|
||||||
|
>
|
||||||
|
Submit
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Addproperty;
|
export default Addproperty;
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
import { useState } from 'react';
|
||||||
|
import "../addproperty.css";
|
||||||
|
|
||||||
|
|
||||||
|
const Addproperty = () => {
|
||||||
|
const [activeTab, setActiveTab] = useState('billing');
|
||||||
|
|
||||||
|
const handleContinue = () => {
|
||||||
|
if (activeTab === 'billing') setActiveTab('shipping');
|
||||||
|
else if (activeTab === 'shipping') setActiveTab('review');
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleBack = () => {
|
||||||
|
if (activeTab === 'review') setActiveTab('shipping');
|
||||||
|
else if (activeTab === 'shipping') setActiveTab('billing');
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="container tabs-wrap">
|
||||||
|
<ul className="nav nav-tabs" role="tablist">
|
||||||
|
<li role="presentation" className={activeTab === 'billing' ? 'active tab' : 'tab'}>
|
||||||
|
<a onClick={() => setActiveTab('billing')} role="tab">Billing Address</a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation" className={activeTab === 'shipping' ? 'active tab' : 'tab'}>
|
||||||
|
<a onClick={() => setActiveTab('shipping')} role="tab">Delivery Address</a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation" className={activeTab === 'review' ? 'active tab' : 'tab'}>
|
||||||
|
<a onClick={() => setActiveTab('review')} role="tab">Review & Payment</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div className="tab-content">
|
||||||
|
{activeTab === 'billing' && (
|
||||||
|
<div role="tabpanel" className="tab-pane active">
|
||||||
|
<h3>Billing Address</h3>
|
||||||
|
<p>Billing Address Form</p>
|
||||||
|
<button className="btn btn-primary continue" onClick={handleContinue}>Continue</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{activeTab === 'shipping' && (
|
||||||
|
<div role="tabpanel" className="tab-pane active">
|
||||||
|
<h3>Shipping Address</h3>
|
||||||
|
<p>Shipping Address Form</p>
|
||||||
|
<button className="btn btn-primary back" onClick={handleBack}>Go Back </button>{" "}
|
||||||
|
<button className="btn btn-primary continue" onClick={handleContinue}>Continue</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{activeTab === 'review' && (
|
||||||
|
<div role="tabpanel" className="tab-pane active">
|
||||||
|
<h3>Review & Place Order</h3>
|
||||||
|
<p>Review & Payment Tab</p>
|
||||||
|
<button className="btn btn-primary back" onClick={handleBack}>Go Back</button>{" "}
|
||||||
|
<button className="btn btn-primary continue">Place Order</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Addproperty;
|
|
@ -1,56 +0,0 @@
|
||||||
|
|
||||||
import { NavLink } from "react-router-dom";
|
|
||||||
|
|
||||||
const Header = () => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
|
|
||||||
<div className="container-fluid p-0 m-0">
|
|
||||||
<nav
|
|
||||||
className="navbar navbar-expand-lg w-100"
|
|
||||||
style={{
|
|
||||||
backgroundColor: "#000000",
|
|
||||||
position: "fixed", // Make the navbar fixed at the top
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
zIndex: 1000, // Ensure the navbar is above other elements
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="container-fluid d-flex align-items-center justify-content-between">
|
|
||||||
|
|
||||||
|
|
||||||
<div className="collapse navbar-collapse" id="navbarSupportedContent">
|
|
||||||
|
|
||||||
<form className="form-inline my-2 my-lg-0">
|
|
||||||
<div className="login_text">
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<NavLink to="/login" className="nav-link">
|
|
||||||
Login
|
|
||||||
</NavLink>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#">
|
|
||||||
<i className="fa fa-user" aria-hidden="true" />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div className="quote_btn">
|
|
||||||
<NavLink to="/register" className="nav-link">
|
|
||||||
Register
|
|
||||||
</NavLink>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Header
|
|
|
@ -77,9 +77,24 @@ const Navbar = () => {
|
||||||
|
|
||||||
<li className="nav-item">
|
<li className="nav-item">
|
||||||
<NavLink to="/contact" className="nav-link">
|
<NavLink to="/contact" className="nav-link">
|
||||||
Contact Us
|
Contact
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
{/* <div className="btn_main">
|
||||||
|
<div className="started_text active">
|
||||||
|
<NavLink to="/addproperty" className="nav-link">Add Property</NavLink>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div> */}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{user?.result?._id ? (
|
{user?.result?._id ? (
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
import Footer from "./Footer"
|
||||||
|
import Navbar from "./Navbar"
|
||||||
|
|
||||||
|
|
||||||
|
const Registrationsuccess = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Navbar />
|
||||||
|
<br /> <br /> <br /> <br />
|
||||||
|
|
||||||
|
|
||||||
|
<div className="col-md-18">
|
||||||
|
<br /><br /><br /><br />
|
||||||
|
<h1 className="card-title text-center">
|
||||||
|
|
||||||
|
{" "}
|
||||||
|
Thank you for joining the world's most trusted realtor investment and borrowers portal.
|
||||||
|
</h1>
|
||||||
|
<h2>We reqest you to kindly <span style={{ fontSize: "2rem", color: "#fda417" }}>check your email inbox </span> and click on the <span style={{ fontSize: "2rem", color: "#fda417" }}>verification link </span>to access the dashboard.</h2>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /> <br /> <br />
|
||||||
|
|
||||||
|
<Footer />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Registrationsuccess
|
|
@ -19,5 +19,5 @@ API.interceptors.request.use((req) => {
|
||||||
export const signUp = (formData) => API.post("/users/signup", formData);
|
export const signUp = (formData) => API.post("/users/signup", formData);
|
||||||
export const signIn = (formData) => API.post("/users/signin", formData);
|
export const signIn = (formData) => API.post("/users/signin", formData);
|
||||||
export const verifyEmail = (id, token, data) => API.get(`/users/${id}/verify/${token}`, data);
|
export const verifyEmail = (id, token, data) => API.get(`/users/${id}/verify/${token}`, data);
|
||||||
export const createProperty = (propertyData) => API.post("/property", propertyData);
|
export const submitProperty = (propertyData) => API.post("/property", propertyData);
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,9 @@ import * as api from "../api";
|
||||||
|
|
||||||
export const login = createAsyncThunk(
|
export const login = createAsyncThunk(
|
||||||
"auth/login",
|
"auth/login",
|
||||||
async ({ formValue, navigate, toast }, { rejectWithValue }) => {
|
async ({ formValue, navigate }, { rejectWithValue }) => {
|
||||||
try {
|
try {
|
||||||
const response = await api.signIn(formValue);
|
const response = await api.signIn(formValue);
|
||||||
toast.success("Login Successfully");
|
|
||||||
navigate("/dashboard");
|
navigate("/dashboard");
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -22,7 +21,7 @@ export const register = createAsyncThunk(
|
||||||
try {
|
try {
|
||||||
const response = await api.signUp(formValue);
|
const response = await api.signUp(formValue);
|
||||||
toast.success("Register Successfully");
|
toast.success("Register Successfully");
|
||||||
navigate("/");
|
navigate("/registrationsuccess");
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return rejectWithValue(err.response.data);
|
return rejectWithValue(err.response.data);
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
|
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
|
||||||
|
// import axios from 'axios';
|
||||||
import * as api from "../api";
|
import * as api from "../api";
|
||||||
|
|
||||||
// Async thunk for submitting the form
|
export const submitProperty = createAsyncThunk(
|
||||||
export const createProperty = createAsyncThunk(
|
'property/submitProperty',
|
||||||
"property/createProperty",
|
async (propertyData, { rejectWithValue }) => {
|
||||||
async (formData, { rejectWithValue }) => {
|
try {
|
||||||
try {
|
const response = await api.submitProperty(propertyData);
|
||||||
const response = await api.createProperty(formData);
|
return response.data;
|
||||||
return response.data;
|
} catch (error) {
|
||||||
} catch (error) {
|
return rejectWithValue(error.response.data);
|
||||||
return rejectWithValue(error.response.data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const propertySlice = createSlice({
|
const propertySlice = createSlice({
|
||||||
name: "property",
|
name: 'property',
|
||||||
initialState: {
|
initialState: {
|
||||||
data: {},
|
property: {},
|
||||||
loading: false,
|
status: 'idle',
|
||||||
error: null,
|
error: null,
|
||||||
},
|
},
|
||||||
reducers: {},
|
reducers: {},
|
||||||
extraReducers: (builder) => {
|
extraReducers: (builder) => {
|
||||||
builder
|
builder
|
||||||
.addCase(createProperty.pending, (state) => {
|
.addCase(submitProperty.pending, (state) => {
|
||||||
state.loading = true;
|
state.status = 'loading';
|
||||||
})
|
})
|
||||||
.addCase(createProperty.fulfilled, (state, action) => {
|
.addCase(submitProperty.fulfilled, (state, action) => {
|
||||||
state.loading = false;
|
state.status = 'succeeded';
|
||||||
state.data = action.payload;
|
state.property = action.payload;
|
||||||
})
|
})
|
||||||
.addCase(createProperty.rejected, (state, action) => {
|
.addCase(submitProperty.rejected, (state, action) => {
|
||||||
state.loading = false;
|
state.status = 'failed';
|
||||||
state.error = action.payload;
|
state.error = action.payload;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default propertySlice.reducer;
|
export default propertySlice.reducer;
|
||||||
|
|
|
@ -14,7 +14,7 @@ export default defineConfig({
|
||||||
|
|
||||||
'/users/signup': 'http://67.225.129.127:3002/',
|
'/users/signup': 'http://67.225.129.127:3002/',
|
||||||
'/users/signin': 'http://67.225.129.127:3002/',
|
'/users/signin': 'http://67.225.129.127:3002/',
|
||||||
'/property': 'http://67.225.129.127:3002/',
|
// '/property': 'http://67.225.129.127:3002/',
|
||||||
// '/users/forgotpassword': 'http://67.225.129.127:3002/',
|
// '/users/forgotpassword': 'http://67.225.129.127:3002/',
|
||||||
// '/users/:id/verify/:token': 'http://67.225.129.127:3002/',
|
// '/users/:id/verify/:token': 'http://67.225.129.127:3002/',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue