l-min-components 1.0.729 → 1.0.735
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
|
@@ -113,7 +113,9 @@ const AccountDropdown = (props) => {
|
|
|
113
113
|
{props?.developerAccountData.length > 0 && (
|
|
114
114
|
<div>
|
|
115
115
|
<h3 style={{ marginBottom: 10 }}>Developer accounts</h3>
|
|
116
|
-
{props?.developerAccountData
|
|
116
|
+
{props?.developerAccountData
|
|
117
|
+
?.filter(developerItem => !developerItem?.pending_delete) // filter out pending delete items
|
|
118
|
+
.map((developerItem, idx) => {
|
|
117
119
|
return (
|
|
118
120
|
<div
|
|
119
121
|
className={`account-info ${
|
|
@@ -155,6 +155,46 @@ const HeaderComponent = (props) => {
|
|
|
155
155
|
}
|
|
156
156
|
}, [selectedAccount]);
|
|
157
157
|
|
|
158
|
+
// Checking for delete account
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
if (userAccountsDetail?.data) {
|
|
161
|
+
let validAccountFound = false;
|
|
162
|
+
const validAccounts = userAccountsDetail.data.results.filter(account => !account.pending_delete);
|
|
163
|
+
|
|
164
|
+
if (selectedAccount && selectedAccount.pending_delete) {
|
|
165
|
+
// If the selected account is pending delete, find an alternative
|
|
166
|
+
const nextValidAccount = validAccounts[0]; // Automatically take the first valid account
|
|
167
|
+
if (nextValidAccount) {
|
|
168
|
+
setSelectedAccount(nextValidAccount);
|
|
169
|
+
validAccountFound = true;
|
|
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
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
setGeneralData((generalData) => ({
|
|
184
|
+
...generalData,
|
|
185
|
+
accounts: userAccountsDetail.data,
|
|
186
|
+
user: userDetails.data,
|
|
187
|
+
selectedAccount,
|
|
188
|
+
defaultAccount: getDefaultAccount.data,
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
191
|
+
}, [
|
|
192
|
+
userAccountsDetail.data,
|
|
193
|
+
selectedAccount,
|
|
194
|
+
personalAccountData,
|
|
195
|
+
]);
|
|
196
|
+
|
|
197
|
+
|
|
158
198
|
const containerRef = useRef(null);
|
|
159
199
|
const secondContainerRef = useRef(null);
|
|
160
200
|
const acctDropdownContainerRef = useRef(null);
|
|
@@ -341,9 +381,7 @@ const HeaderComponent = (props) => {
|
|
|
341
381
|
handleGetUnreadNotification();
|
|
342
382
|
handleGeneralNotificationCount();
|
|
343
383
|
}, [notificationMarkReadData?.response]);
|
|
344
|
-
|
|
345
|
-
console.log(selectedAccount, "sel");
|
|
346
|
-
console.log("====================================");
|
|
384
|
+
|
|
347
385
|
return (
|
|
348
386
|
<Navbar>
|
|
349
387
|
<img src={logo} alt="Learngual logo" />
|