From aeef8a370ffbb225cea7f9f77d697b593dbcbffe Mon Sep 17 00:00:00 2001
From: Harshith DS <harshith.ds@matriotsolutions.com>
Date: Tue, 2 Aug 2022 19:05:34 +0530
Subject: [PATCH] TMSS-1657:- Fixed redirecting issue in cycle and project edit
 page while saving

---
 SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/edit.js   | 2 +-
 SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/edit.js
index 2d63ed95976..5814fa5705c 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/edit.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/edit.js
@@ -332,7 +332,7 @@ export class CycleEdit extends Component {
                 .then(async (cycle) => { 
                     if (cycle && this.state.cycle.updated_at !== cycle.updated_at) {
                         this.saveCycleQuota(cycle);
-                        this.props.history.length>2 && this.props.history.go(-2);
+                        this.props.history.length>2 && this.state.isDirty? this.props.history.go(-2):this.props.history.go(-1);
                     }   else {
                         this.growl.show({severity: 'error', summary: 'Error Occured', detail: 'Unable to update Cycle'});
                         //this.setState({errors: cycle});
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js
index bad5ca428d5..95310e6d147 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js
@@ -385,7 +385,7 @@ export class ProjectEdit extends Component {
                         project.archive_location = archive_location;
                         project.archiveId = archiveId;
                         this.saveProjectQuota(project);
-                        this.props.history.length>2 && this.props.history.go(-2);
+                        this.props.history.length>2 && this.state.isDirty? this.props.history.go(-2):this.props.history.go(-1);
                     }   else {
                         this.growl.show({severity: 'error', summary: 'Error Occured', detail: 'Unable to update Project'});
                         this.setState({errors: project});
-- 
GitLab