courrier preview
This commit is contained in:
parent
e10dd6e94a
commit
dc8febe5f8
@ -665,9 +665,30 @@ export default function CourrierPage() {
|
||||
setLoading(false);
|
||||
}
|
||||
}}
|
||||
onEditAccount={(account) => {
|
||||
setAccountToEdit(account as any);
|
||||
setShowEditModal(true);
|
||||
onEditAccount={async (account) => {
|
||||
try {
|
||||
// Get the latest account data from accounts array
|
||||
const updatedAccount = accounts.find(a => a.id === account.id);
|
||||
if (updatedAccount) {
|
||||
setAccountToEdit(updatedAccount as any);
|
||||
setShowEditModal(true);
|
||||
} else {
|
||||
toast({
|
||||
title: "Error",
|
||||
description: "Could not find account data",
|
||||
variant: "destructive",
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error preparing account edit:", error);
|
||||
toast({
|
||||
title: "Error",
|
||||
description: "Failed to load account settings",
|
||||
variant: "destructive",
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
}}
|
||||
onDeleteAccount={(account) => {
|
||||
setAccountToDelete(account as any);
|
||||
@ -964,6 +985,8 @@ export default function CourrierPage() {
|
||||
? {...account, name: displayName, color: color}
|
||||
: account
|
||||
));
|
||||
// Clear accountToEdit to ensure fresh data on next edit
|
||||
setAccountToEdit(null);
|
||||
} catch (err) {
|
||||
toast({ title: 'Error', description: err instanceof Error ? err.message : 'Failed to update account settings', variant: 'destructive' });
|
||||
} finally {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user