Skip to content

Commit

Permalink
Heroku frontend 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Peril committed May 11, 2022
1 parent c8ecb57 commit ae161b3
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions src/components/AdminDashboard/AdminDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const AdminDashboard = () => {

async function fetchData(){
await fetch(
"http://localhost:4000/user/all")
"https://auctionpointfrontend.herokuapp.com/user/all")
.then((res) => res.json())
.then((json) => {
setUserList(json)
Expand All @@ -21,7 +21,7 @@ const AdminDashboard = () => {
});

await fetch(
"http://localhost:4000/auction/all")
"https://auctionpointfrontend.herokuapp.com/auction/all")
.then((res) => res.json())
.then((json) => {
setProductList(json)
Expand Down
4 changes: 2 additions & 2 deletions src/components/AdminDashboard/DropProduct.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const DropProduct = () => {

async function fetchData(){
await fetch(
"http://localhost:4000/auction/all")
"https://auctionpointfrontend.herokuapp.com/auction/all")
.then((res) => res.json())
.then((json) => {
setProductList(json)
Expand All @@ -30,7 +30,7 @@ const DropProduct = () => {
function handleDelete(user_id, e) {
e.preventDefault();
async function deletePost() {
await fetch("http://localhost:4000/auction/deleteAuction/"+user_id,
await fetch("https://auctionpointfrontend.herokuapp.com/auction/deleteAuction/"+user_id,
{ method: 'DELETE' });
toast.success("User deleted successfully");
//toast error
Expand Down
4 changes: 2 additions & 2 deletions src/components/AdminDashboard/DropUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const DropUser = () => {

async function fetchData(){
await fetch(
"http://localhost:4000/user/all")
"https://auctionpointfrontend.herokuapp.com/user/all")
.then((res) => res.json())
.then((json) => {
setUserList(json)
Expand All @@ -28,7 +28,7 @@ export const DropUser = () => {
function handleDelete(user_id, e) {
e.preventDefault();
async function deletePost() {
await fetch("http://localhost:4000/user/deleteUser/"+user_id,
await fetch("https://auctionpointfrontend.herokuapp.com/user/deleteUser/"+user_id,
{ method: 'DELETE' })
.then(async response =>{
if(!response.ok)
Expand Down
14 changes: 7 additions & 7 deletions src/components/BidProduct.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const BidProduct = ({ notify }) => {
if (params) {
let userId;
async function fetchData() {
await fetch(`http://localhost:4000/Auction/getBid/${params.id}`)
await fetch(`https://auctionpointfrontend.herokuapp.com/Auction/getBid/${params.id}`)
.then((res) => res.json())
.then((json) => {
userId = json.userId;
Expand All @@ -31,19 +31,19 @@ const BidProduct = ({ notify }) => {
// }
});
// console.log(bidProduct?.userId);
await fetch(`http://localhost:4000/user/${userId}`)
await fetch(`https://auctionpointfrontend.herokuapp.com/user/${userId}`)
.then((res) => res.json())
.then((json) => {
setSeller(json.firstName + " " + json.lastName);
});

await fetch(`http://localhost:4000/user/${uid}`)
await fetch(`https://auctionpointfrontend.herokuapp.com/user/${uid}`)
.then((res) => res.json())
.then((json) => {
setUser(json);
});

await fetch(`http://localhost:4000/wallet/${uid}`)
await fetch(`https://auctionpointfrontend.herokuapp.com/wallet/${uid}`)
.then((res) => res.json())
.then((json) => {
setBalance(json.amount);
Expand All @@ -64,7 +64,7 @@ const BidProduct = ({ notify }) => {
if (Object.keys(errs).length === 0) {
///bidProduct/:id
let result = await fetch(
`http://localhost:4000/auction/bidProduct/${params.id}`,
`https://auctionpointfrontend.herokuapp.com/auction/bidProduct/${params.id}`,
{
method: "PUT",
headers: {
Expand Down Expand Up @@ -154,7 +154,7 @@ const BidProduct = ({ notify }) => {
{bidProduct.productImage.map((item, index) => {
return (
<img
src={"http://localhost:4000/uploads/" + item}
src={"https://auctionpointfrontend.herokuapp.com/uploads/" + item}
key={index}
alt=""
className="img-fluid rounded-3"
Expand All @@ -165,7 +165,7 @@ const BidProduct = ({ notify }) => {
) : (
<img
src={
"http://localhost:4000/uploads/" +
"https://auctionpointfrontend.herokuapp.com/uploads/" +
bidProduct.productImage[0]
}
alt=""
Expand Down
2 changes: 1 addition & 1 deletion src/components/CreateAuction.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const CreateAuction = ({notify}) => {
formData.append("startDate",product.startdate);
formData.append("endDate",product.enddate);

let result = await fetch("http://localhost:4000/auction/add-product", {
let result = await fetch("https://auctionpointfrontend.herokuapp.com/auction/add-product", {
method: 'POST',
headers: {
"Accept": "application/json"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Feedback.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const FeedBack = ()=>{

let item = { userId, date, comments };

let result = await fetch("http://localhost:4000/feedback/add_feedback", {
let result = await fetch("https://auctionpointfrontend.herokuapp.com/feedback/add_feedback", {
method: 'POST',
body: JSON.stringify(item),
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Forgotpassword.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function Forgotpassword({notify}) {
let data = {
email:values.email
}
let result = await fetch("http://localhost:4000/user/forgot-password", {
let result = await fetch("https://auctionpointfrontend.herokuapp.com/user/forgot-password", {
method: 'POST',
headers: {
"Content-Type": "application/json",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Home = () => {

useEffect(() => {
async function fetchData() {
await fetch("http://localhost:4000/auction/all")
await fetch("https://auctionpointfrontend.herokuapp.com/auction/all")
.then((res) => res.json())
.then((json) => {
if (json === undefined) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Login = ({notify}) => {
const password = event.target.password.value;

let item = { email, password };
let result = await fetch("http://localhost:4000/user/login", {
let result = await fetch("https://auctionpointfrontend.herokuapp.com/user/login", {
method: 'POST',
headers: {
"Content-Type": "application/json",
Expand All @@ -72,7 +72,7 @@ const Login = ({notify}) => {
if(result.error === "No user found"){
/*setErrors({"email":"No email Found."})
notify("No email Found.")*/
let result2 = await fetch("http://localhost:4000/admin/admin_login", {
let result2 = await fetch("https://auctionpointfrontend.herokuapp.com/admin/admin_login", {
method: 'POST',
headers: {
"Content-Type": "application/json",
Expand Down Expand Up @@ -104,7 +104,7 @@ const Login = ({notify}) => {
}else if(result.error === "Please Verify Your Account Before Logging In." || result ==="Please Verify Your Account Before Logging In."){
notify("Please Verify Your Account Before Logging In.")
}else if(result.error === "Please Verify Your Account Before Logging In."){
let result2 = await fetch("http://localhost:4000/admin/admin_login", {
let result2 = await fetch("https://auctionpointfrontend.herokuapp.com/admin/admin_login", {
method: 'POST',
headers: {
"Content-Type": "application/json",
Expand Down
4 changes: 2 additions & 2 deletions src/components/ProductCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const ProductCard = ({product,role, handleOnDeleteBtnClick,notify}) => {
amount
}

let result = await fetch("http://localhost:4000/transaction/add_transaction", {
let result = await fetch("https://auctionpointfrontend.herokuapp.com/transaction/add_transaction", {
method: 'POST',
headers: {
"Content-Type": "application/json",
Expand All @@ -69,7 +69,7 @@ const ProductCard = ({product,role, handleOnDeleteBtnClick,notify}) => {
{/* {startTimer} */}
<div className="d-flex w-100 justify-content-center align-items-center">
{/* <img className='img-fluid' src={`https://picsum.photos/500/500?random=${Math.random()*10}`} style={{width:"20rem", height:"15rem", objectFit:"cover"}} /> */}
<img className='img-fluid' src={ product?.productImage[0]?"http://localhost:4000/uploads/"+product?.productImage[0]:`https://picsum.photos/500/500?random=${Math.random()*10}`} style={{width:"20rem", height:"15rem", objectFit:"cover"}} />
<img className='img-fluid' src={ product?.productImage[0]?"https://auctionpointfrontend.herokuapp.com/uploads/"+product?.productImage[0]:`https://picsum.photos/500/500?random=${Math.random()*10}`} style={{width:"20rem", height:"15rem", objectFit:"cover"}} />
</div>
{/* Title */}
<div className='d-flex align-items-center text-capitalize w-100 p-3 fw-bold text-break' style={{height:"80px"}}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Products.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const Products = ({ notify }) => {

useEffect(() => {
async function fetchData() {
await fetch("http://localhost:4000/auction/all")
await fetch("https://auctionpointfrontend.herokuapp.com/auction/all")
.then((res) => res.json())
.then((json) => {
if (json === undefined) {
Expand Down Expand Up @@ -106,7 +106,7 @@ const Products = ({ notify }) => {
alert("You can not delete this.");
} else {
setMyAuctions(myAuctions.filter((value) => value._id != product._id));
await fetch(`http://localhost:4000/auction/deleteAuction/${product._id}`,{
await fetch(`https://auctionpointfrontend.herokuapp.com/auction/deleteAuction/${product._id}`,{
method: 'DELETE',
headers: {
"Accept": "application/json"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Register.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const Register = ({notify}) => {

let item = { firstName, lastName, dob, email, mobileNumber, password, aadharNumber, address, gender }
// console.warn(item)
let result = await fetch("http://localhost:4000/user/register", {
let result = await fetch("https://auctionpointfrontend.herokuapp.com/user/register", {
method: 'POST',
body: JSON.stringify(item),
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/UpdateAuction.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const UpdateAuction = () => {
let {id:auctionId} = useParams()

useEffect(async ()=>{
let result = await fetch(`http://localhost:4000/auction/getBid/${auctionId}`, {
let result = await fetch(`https://auctionpointfrontend.herokuapp.com/auction/getBid/${auctionId}`, {
method: 'GET',
headers: {
"Content-Type": "application/json",
Expand Down
16 changes: 8 additions & 8 deletions src/components/UserProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ const UserProfile = () => {
useEffect(() => {
// var arr = [];
async function fetchData() {
await fetch("http://localhost:4000/user/" + userid)
await fetch("https://auctionpointfrontend.herokuapp.com/user/" + userid)
.then((res) => res.json())
.then((json) => {
setUserData(json);
setUpdateUser(json);
//console.log(json);
});

await fetch("http://localhost:4000/auction/" + userid)
await fetch("https://auctionpointfrontend.herokuapp.com/auction/" + userid)
.then((res) => res.json())
.then((json) => {
setUserAuction(json);
});


await fetch("http://localhost:4000/transaction/get_transaction/"+userid)
await fetch("https://auctionpointfrontend.herokuapp.com/transaction/get_transaction/"+userid)
.then((res) => res.json())
.then(async (json) => {
for (let item of json) {

let result = await fetch(`http://localhost:4000/auction/getBid/${item.auctionId}`)
let result = await fetch(`https://auctionpointfrontend.herokuapp.com/auction/getBid/${item.auctionId}`)

result = result.json().then((res)=>{
if (res !== null) setWonAuction([...wonAuction,res])
Expand Down Expand Up @@ -80,7 +80,7 @@ const UserProfile = () => {
formData.append("avtar", profile_pic); // appending every file to formdata

let result = await fetch(
"http://localhost:4000/fileApi/uploadFile/" + userid,
"https://auctionpointfrontend.herokuapp.com/fileApi/uploadFile/" + userid,
{
method: "PUT",
headers: {
Expand Down Expand Up @@ -114,7 +114,7 @@ const UserProfile = () => {

let item = { firstName, address, mobileNumber, email, password };
let result = await fetch(
"http://localhost:4000/user/updateUser/" + userid,
"https://auctionpointfrontend.herokuapp.com/user/updateUser/" + userid,
{
method: "PUT",
body: JSON.stringify(item),
Expand All @@ -137,7 +137,7 @@ const UserProfile = () => {

let item = { firstName, address, mobileNumber, email };
let result = await fetch(
"http://localhost:4000/user/updateUser/" + userid,
"https://auctionpointfrontend.herokuapp.com/user/updateUser/" + userid,
{
method: "PUT",
body: JSON.stringify(item),
Expand Down Expand Up @@ -178,7 +178,7 @@ const UserProfile = () => {
<img
src={
userData.avtar &&
"http://localhost:4000/uploads/" +
"https://auctionpointfrontend.herokuapp.com/uploads/" +
userData.avtar
}
className="rounded-circle"
Expand Down
2 changes: 1 addition & 1 deletion src/components/VerifyForgotToken.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const VerifyForgotToken = ({notify})=>{
if(Object.keys(errs).length===0){
//call backend api
let item = { newpassword:values.password };
let result = await fetch(`http://localhost:4000/user/reset-password/${token}/${uid}`, {
let result = await fetch(`https://auctionpointfrontend.herokuapp.com/user/reset-password/${token}/${uid}`, {
method: 'POST',
headers: {
"Content-Type": "application/json",
Expand Down
4 changes: 2 additions & 2 deletions src/components/VerifyUser.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const [isPending,setIsPending] = useState(true)
const {uid,token} = useParams()

useEffect(async ()=>{
// fetch(`http://localhost:4000/user/verify-account/1ebf1abda33c178503476212df073b73b09a48868ec6aca226caaeecc75d0dd1/627a48c12f52bf3d2857ebda`)
let result = await fetch(`http://localhost:4000/user/verify-account/${token}/${uid}`, {
// fetch(`https://auctionpointfrontend.herokuapp.com/user/verify-account/1ebf1abda33c178503476212df073b73b09a48868ec6aca226caaeecc75d0dd1/627a48c12f52bf3d2857ebda`)
let result = await fetch(`https://auctionpointfrontend.herokuapp.com/user/verify-account/${token}/${uid}`, {
method: 'GET',
headers: {
"Content-Type": "application/json",
Expand Down
6 changes: 3 additions & 3 deletions src/components/Wallet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Wallet = ({ notify }) => {
const userid = sessionStorage.getItem("user");

useEffect(async () => {
await fetch(`http://localhost:4000/wallet/${userid}`)
await fetch(`https://auctionpointfrontend.herokuapp.com/wallet/${userid}`)
.then((res) => res.json())
.then((json) => {
setWallet(json.amount);
Expand All @@ -25,7 +25,7 @@ const Wallet = ({ notify }) => {
}
let amount = wallet + parseInt(document.getElementById("add-amount").value);
let result = await fetch(
`http://localhost:4000/wallet/updateWallet/${userid}`,
`https://auctionpointfrontend.herokuapp.com/wallet/updateWallet/${userid}`,
{
method: "PUT",
headers: {
Expand All @@ -48,7 +48,7 @@ const Wallet = ({ notify }) => {
} else {
let amount = wallet - amt;
let result = await fetch(
`http://localhost:4000/wallet/updateWallet/${userid}`,
`https://auctionpointfrontend.herokuapp.com/wallet/updateWallet/${userid}`,
{
method: "PUT",
headers: {
Expand Down

0 comments on commit ae161b3

Please sign in to comment.