mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-25 13:56:10 +00:00
fix(clients): use new email after rename and de-duplicate save toast
On client edit the post-update calls (attach/detach/externalLinks) keyed by the original email, so renaming a client made setExternalLinks fail with record-not-found. Key them by the updated email instead. Each of those sub-step POSTs also auto-toasted its own success, so a save fired the 'Inbound client has been updated' toast twice (or more). Add a silentSuccess HttpUtil option that suppresses the redundant success toast while still surfacing errors and the node-offline warning, and apply it to the attach/detach/externalLinks mutations.
This commit is contained in:
@@ -685,16 +685,18 @@ export default function ClientsPage() {
|
||||
}
|
||||
const updateMsg = await update(meta.email, payload);
|
||||
if (!updateMsg?.success) return updateMsg;
|
||||
const rawEmail = (payload as { email?: unknown }).email;
|
||||
const emailKey = typeof rawEmail === 'string' && rawEmail.trim() ? rawEmail.trim() : meta.email;
|
||||
if (Array.isArray(meta.attach) && meta.attach.length > 0) {
|
||||
const r = await attach(meta.email, meta.attach);
|
||||
const r = await attach(emailKey, meta.attach);
|
||||
if (!r?.success) return r;
|
||||
}
|
||||
if (Array.isArray(meta.detach) && meta.detach.length > 0) {
|
||||
const r = await detach(meta.email, meta.detach);
|
||||
const r = await detach(emailKey, meta.detach);
|
||||
if (!r?.success) return r;
|
||||
}
|
||||
// Always replace the client's external links (an empty set clears them).
|
||||
const r = await setExternalLinks(meta.email, meta.externalLinks);
|
||||
const r = await setExternalLinks(emailKey, meta.externalLinks);
|
||||
if (!r?.success) return r;
|
||||
return updateMsg;
|
||||
}, [create, update, attach, detach, setExternalLinks]);
|
||||
|
||||
Reference in New Issue
Block a user