From 464a30c31b9663eff565ce5cb61f2a01c2f21b3f Mon Sep 17 00:00:00 2001 From: alma Date: Mon, 28 Apr 2025 19:08:09 +0200 Subject: [PATCH] courrier multi account restore compose --- app/courrier/page.tsx | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index f5b21e61..cd4d3405 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -857,27 +857,13 @@ export default function CourrierPage() { console.log('Connection test successful:', testResult); // If connection test is successful, save the account - const saveResponse = await fetch('/api/courrier/account', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(formValues) - }); - - const saveResult = await saveResponse.json(); - - if (!saveResponse.ok) { - throw new Error(saveResult.error || 'Failed to add account'); - } - - // Update accounts list + const realAccounts = accounts.filter(a => a.id !== 'loading-account'); const newAccountObj = { - id: `account-${Date.now()}`, // generate unique string ID + id: `account-${Date.now()}`, name: formValues.display_name, email: formValues.email, - color: colorPalette[(accounts.length) % colorPalette.length], - folders: testResult.details.sampleFolders || ['INBOX', 'Sent', 'Drafts', 'Trash'] // Use discovered folders or defaults + color: colorPalette[realAccounts.length % colorPalette.length], + folders: testResult.details.sampleFolders || ['INBOX', 'Sent', 'Drafts', 'Trash'] }; setAccounts(prev => [...prev, newAccountObj]);