l-min-components 1.0.741 → 1.0.747
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -35,7 +35,6 @@ const AppMainLayout = () => {
|
|
|
35
35
|
const [rightLayout, setRightLayout] = useState(true);
|
|
36
36
|
const [rightComponent, setRightComponent] = useState();
|
|
37
37
|
const [generalData, setGeneralData] = useState({});
|
|
38
|
-
const [deleteAccount, setDeleteAccount] = useState(false)
|
|
39
38
|
const [coming, setComing] = useState();
|
|
40
39
|
const [activePage, setActivePage] = useState("reports");
|
|
41
40
|
const [page, setPage] = useState("index");
|
|
@@ -160,8 +159,6 @@ const AppMainLayout = () => {
|
|
|
160
159
|
setRightLayout,
|
|
161
160
|
generalData,
|
|
162
161
|
setGeneralData,
|
|
163
|
-
deleteAccount,
|
|
164
|
-
setDeleteAccount,
|
|
165
162
|
coming,
|
|
166
163
|
hasLayoutBackgroundImage,
|
|
167
164
|
setHasLayoutBackgroundImage,
|
|
@@ -61,7 +61,7 @@ const HeaderComponent = (props) => {
|
|
|
61
61
|
handleGetNotification,
|
|
62
62
|
} = useHeader();
|
|
63
63
|
const { pathname } = useLocation();
|
|
64
|
-
const { setGeneralData, generalData,
|
|
64
|
+
const { setGeneralData, generalData, notificationMarkReadData } =
|
|
65
65
|
useContext(OutletContext);
|
|
66
66
|
const [selectedAccount, setSelectedAccount] = useState();
|
|
67
67
|
const { setDefaultAccount, handleSetDefaultAccount } = useHeader();
|
|
@@ -157,46 +157,26 @@ const HeaderComponent = (props) => {
|
|
|
157
157
|
|
|
158
158
|
// Checking for delete account
|
|
159
159
|
useEffect(() => {
|
|
160
|
-
if (userAccountsDetail?.data
|
|
161
|
-
let validAccountFound = false;
|
|
160
|
+
if (userAccountsDetail?.data) {
|
|
162
161
|
const validAccounts = userAccountsDetail.data.results.filter(account => !account.pending_delete);
|
|
163
|
-
|
|
164
|
-
if (selectedAccount && selectedAccount
|
|
165
|
-
|
|
166
|
-
const nextValidAccount = validAccounts[0]; // Automatically take the first valid account
|
|
162
|
+
|
|
163
|
+
if (generalData?.selectedAccount && generalData?.selectedAccount?.pending_delete) {
|
|
164
|
+
const nextValidAccount = validAccounts[0];
|
|
167
165
|
if (nextValidAccount) {
|
|
168
166
|
setSelectedAccount(nextValidAccount);
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (!validAccountFound) {
|
|
174
|
-
// If no valid account is found or no specific logic has been triggered yet
|
|
175
|
-
if (validAccounts.length > 0) {
|
|
176
|
-
setSelectedAccount(validAccounts[0]); // Set to first valid account by default
|
|
177
|
-
} else {
|
|
178
|
-
// Fallback to personal account or some default setting
|
|
179
|
-
setSelectedAccount(personalAccountData[0]);
|
|
180
|
-
}
|
|
167
|
+
} else {
|
|
168
|
+
// Fallback to personal account or some default setting
|
|
169
|
+
setSelectedAccount(personalAccountData[0]);
|
|
170
|
+
}
|
|
181
171
|
}
|
|
182
172
|
|
|
183
|
-
setGeneralData((generalData) => ({
|
|
184
|
-
...generalData,
|
|
185
|
-
accounts: userAccountsDetail.data,
|
|
186
|
-
user: userDetails.data,
|
|
187
|
-
selectedAccount,
|
|
188
|
-
defaultAccount: getDefaultAccount.data,
|
|
189
|
-
accountDelete: false,
|
|
190
|
-
}));
|
|
191
173
|
}
|
|
192
174
|
}, [
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
deleteAccount,
|
|
175
|
+
generalData?.selectedAccount,
|
|
176
|
+
userAccountsDetail?.data,
|
|
177
|
+
|
|
197
178
|
]);
|
|
198
179
|
|
|
199
|
-
|
|
200
180
|
const containerRef = useRef(null);
|
|
201
181
|
const secondContainerRef = useRef(null);
|
|
202
182
|
const acctDropdownContainerRef = useRef(null);
|