courrier multi account restore compose
This commit is contained in:
parent
cc988b7b8c
commit
ab6e34c4fa
@ -312,7 +312,7 @@ export default function CourrierPage() {
|
||||
folders: accountFolders
|
||||
};
|
||||
console.log(`[DEBUG] Updated loading account to real account: ${account.email} with ID ${account.id}`);
|
||||
} else {
|
||||
} else if (index > 0) {
|
||||
// Add additional accounts as new entries
|
||||
updatedAccounts.push({
|
||||
id: account.id || `account-${index}`,
|
||||
@ -321,28 +321,31 @@ export default function CourrierPage() {
|
||||
color: account.color || 'bg-blue-500',
|
||||
folders: accountFolders
|
||||
});
|
||||
console.log(`[DEBUG] Added additional account: ${account.email} with ID ${account.id}`);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Fallback if accounts array is empty for some reason
|
||||
updatedAccounts.push({ id: 'all-accounts', name: 'All', email: '', color: 'bg-gray-500' });
|
||||
|
||||
const firstAccount = data.allAccounts[0];
|
||||
const accountFolders = (firstAccount.folders && Array.isArray(firstAccount.folders))
|
||||
? firstAccount.folders
|
||||
: (data.mailboxes && Array.isArray(data.mailboxes))
|
||||
? data.mailboxes
|
||||
: ['INBOX', 'Sent', 'Drafts', 'Trash', 'Junk'];
|
||||
|
||||
updatedAccounts.push({
|
||||
id: firstAccount.id,
|
||||
name: firstAccount.display_name || firstAccount.email,
|
||||
email: firstAccount.email,
|
||||
color: firstAccount.color || 'bg-blue-500',
|
||||
folders: accountFolders
|
||||
// Add all accounts from the API response
|
||||
data.allAccounts.forEach((account: any) => {
|
||||
const accountFolders = (account.folders && Array.isArray(account.folders))
|
||||
? account.folders
|
||||
: (data.mailboxes && Array.isArray(data.mailboxes))
|
||||
? data.mailboxes
|
||||
: ['INBOX', 'Sent', 'Drafts', 'Trash', 'Junk'];
|
||||
|
||||
updatedAccounts.push({
|
||||
id: account.id,
|
||||
name: account.display_name || account.email,
|
||||
email: account.email,
|
||||
color: account.color || 'bg-blue-500',
|
||||
folders: accountFolders
|
||||
});
|
||||
});
|
||||
}
|
||||
} else if (data.email) {
|
||||
} else {
|
||||
// Fallback to single account if allAccounts is not available
|
||||
console.log(`[DEBUG] Fallback to single account: ${data.email}`);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user