From 7c857b354b45d6730fac811a90c834a61de9d1ed Mon Sep 17 00:00:00 2001
From: lewa <lene.wasskog@nibio.no>
Date: Mon, 29 Apr 2024 13:26:16 +0200
Subject: [PATCH] feat: Redirect to crop category only if not selected

---
 src/components/LoginSystem.vue | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/components/LoginSystem.vue b/src/components/LoginSystem.vue
index 246a695..fdfbf59 100644
--- a/src/components/LoginSystem.vue
+++ b/src/components/LoginSystem.vue
@@ -123,7 +123,6 @@
 		methods: {
 			/** Get  user details from local storage */
 			getUserFromStorage() {
-
 				let strUser = localStorage.getItem(CommonUtil.CONST_STORAGE_USER_DETAIL);
 				if (strUser && strUser != 'undefined') {
 					let user = JSON.parse(strUser);
@@ -135,7 +134,8 @@
 					this.userLoggedInName = this.$root.sharedState.user.firstName + " " + this.$root.sharedState.user.lastName;
 				}
 				/** Show the observation list instead of welcome page if user is logged in */
-				if(this.$root.sharedState.uuid) {
+        const cropCategorySelected = localStorage.getItem(CommonUtil.CONST_STORAGE_CROP_ID_LIST) !== null;
+				if(this.$root.sharedState.uuid && !cropCategorySelected) {
 					this.$router.push("/cropCategory");
 				}
 			},
-- 
GitLab