l-min-components 1.0.741 → 1.0.744
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
|
@@ -157,43 +157,22 @@ 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
162
|
|
|
164
|
-
if (selectedAccount && selectedAccount
|
|
165
|
-
|
|
166
|
-
const nextValidAccount = validAccounts[0]; // Automatically take the first valid account
|
|
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
|
-
selectedAccount,
|
|
195
|
-
personalAccountData,
|
|
196
|
-
deleteAccount,
|
|
175
|
+
generalData?.selectedAccount,
|
|
197
176
|
]);
|
|
198
177
|
|
|
199
178
|
|