refactor: simplify access token toast and remove unnecessary fragment wrapper

- Removed redundant React fragment in Attachments.tsx for cleaner structure
- Removed fallback logic for access token description in toast; use created.description directly since description is always required by client-side validation.
- Removed unused i18n key access-token-created-default since description is always present
pull/5111/head
Nic Luckie 3 weeks ago
parent c7b53930cc
commit d3e6302526

@ -29,15 +29,10 @@ const AccessTokenSection = () => {
});
}, []);
const handleCreateAccessTokenDialogConfirm = async (created?: UserAccessToken) => {
// Refresh list to reflect server state and include stable fields like issuedAt/expiresAt
const handleCreateAccessTokenDialogConfirm = async (created: UserAccessToken) => {
const accessTokens = await listAccessTokens(currentUser.name);
setUserAccessTokens(accessTokens);
toast.success(
t("setting.access-token-section.create-dialog.access-token-created", {
description: created?.description ?? t("setting.access-token-section.create-dialog.access-token-created-default"),
}),
);
toast.success(t("setting.access-token-section.create-dialog.access-token-created", { description: created.description }));
};
const handleCreateToken = () => {

@ -245,7 +245,6 @@
"access-token-deleted": "Access token `{{description}}` deleted",
"create-dialog": {
"access-token-created": "Access token `{{description}}` created",
"access-token-created-default": "Access token created",
"create-access-token": "Create Access Token",
"created-at": "Created At",
"description": "Description",

@ -55,7 +55,6 @@ const Attachments = observer(() => {
}, []);
return (
<>
<section className="@container w-full max-w-5xl min-h-full flex flex-col justify-start items-center sm:pt-3 md:pt-6 pb-8">
{!md && <MobileHeader />}
<div className="w-full px-4 sm:px-6">
@ -152,7 +151,6 @@ const Attachments = observer(() => {
</div>
</div>
</section>
</>
);
});

Loading…
Cancel
Save