From 544705f96ab190c325d604c318788b417b4bf826 Mon Sep 17 00:00:00 2001 From: sonali Date: Thu, 3 Oct 2024 17:44:26 +0530 Subject: [PATCH] 'my change ' --- .../Expense/ExpenseSuccessfully/ExpenseSuccessfully.js | 10 ++++++---- .../pages/Income/Income/IncomeSuccessfully.js | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/pages/Expense/ExpenseSuccessfully/ExpenseSuccessfully.js b/src/components/pages/Expense/ExpenseSuccessfully/ExpenseSuccessfully.js index 0865df0..6efab2d 100644 --- a/src/components/pages/Expense/ExpenseSuccessfully/ExpenseSuccessfully.js +++ b/src/components/pages/Expense/ExpenseSuccessfully/ExpenseSuccessfully.js @@ -1,7 +1,7 @@ import React, { useEffect, useState } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faArrowLeft } from "@fortawesome/free-solid-svg-icons"; -import { useNavigate } from "react-router-dom"; +import { useNavigate , useLocation } from "react-router-dom"; import { Player } from "@lottiefiles/react-lottie-player"; import successAnimation from "../Common/Animation - 1727464749500.json"; import "../ExpenseSuccessfully/ExpenseSuccessfully.css" @@ -9,6 +9,8 @@ import "../ExpenseSuccessfully/ExpenseSuccessfully.css" function ExpenseSuccessfully() { const [currentDate, setCurrentDate] = useState(new Date()); const navigate = useNavigate(); + const location = useLocation(); + const entryType = location.state?.entryType; useEffect(() => { const timer = setInterval(() => { @@ -19,15 +21,15 @@ function ExpenseSuccessfully() { }, []); const handleBackClick = () => { - navigate("/expense-editPage"); + navigate("/expense-editPage" , { state: { entryType } }); }; const handleBackToHome = () => { - navigate("/"); + navigate("/" , { state: { entryType } }); }; const handleBackToRecord = () => { - navigate("/expense-records") + navigate("/expense-records" , { state: { entryType } }) } const options = { hour: "2-digit", minute: "2-digit", hour12: true }; diff --git a/src/components/pages/Income/Income/IncomeSuccessfully.js b/src/components/pages/Income/Income/IncomeSuccessfully.js index 0dfe0ab..5acb7ad 100644 --- a/src/components/pages/Income/Income/IncomeSuccessfully.js +++ b/src/components/pages/Income/Income/IncomeSuccessfully.js @@ -1,7 +1,7 @@ import React, { useEffect, useState } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faArrowLeft } from "@fortawesome/free-solid-svg-icons"; -import { useNavigate } from "react-router-dom"; +import { useNavigate , useLocation } from "react-router-dom"; import { Player } from "@lottiefiles/react-lottie-player"; import successAnimation from "../Common/Animation - 1727464749500.json"; import "../Income/IncomeSuccessfully.css"; @@ -9,6 +9,8 @@ import "../Income/IncomeSuccessfully.css"; function IncomeSuccessfully() { const [currentDate, setCurrentDate] = useState(new Date()); const navigate = useNavigate(); + const location = useLocation(); + const entryType = location.state?.entryType; useEffect(() => { const timer = setInterval(() => { @@ -19,15 +21,15 @@ function IncomeSuccessfully() { }, []); const handleBackClick = () => { - navigate("/editPage"); + navigate("/editPage" , { state: { entryType } }); }; const handleBackToHome = () => { - navigate("/"); + navigate("/" , { state: { entryType } }); }; const handleBackToRecord = () => { - navigate("/records") + navigate("/records" , { state: { entryType } }) } const options = { hour: "2-digit", minute: "2-digit", hour12: true };