Toast fixes/refactoring (#4289)

* Memoize Toast functions
* Rename Toast.success to Toast.toast, add new Toast.success
* Disable prefer-destructuring on AssignmentExpression
This commit is contained in:
DingDongSoLong4
2023-11-20 05:14:34 +02:00
committed by GitHub
parent 049a1b15c3
commit f9e11813f0
52 changed files with 336 additions and 387 deletions

View File

@@ -174,21 +174,19 @@ const StudioPage: React.FC<IProps> = ({ studio, tabKey }) => {
},
});
toggleEditing(false);
Toast.success({
content: intl.formatMessage(
Toast.success(
intl.formatMessage(
{ id: "toast.updated_entity" },
{ entity: intl.formatMessage({ id: "studio" }).toLocaleLowerCase() }
),
});
)
);
}
async function onAutoTag() {
if (!studio.id) return;
try {
await mutateMetadataAutoTag({ studios: [studio.id] });
Toast.success({
content: intl.formatMessage({ id: "toast.started_auto_tagging" }),
});
Toast.success(intl.formatMessage({ id: "toast.started_auto_tagging" }));
} catch (e) {
Toast.error(e);
}