1
0
Fork 0
VaultUI/src/utils/clipboardNotifs.ts
2022-01-21 22:32:05 +00:00

23 lines
630 B
TypeScript

import i18next from "i18next";
import UIkit from "uikit";
export function addClipboardNotifications(clipboard: ClipboardJS, timeout = 1000): void {
clipboard.on("success", () => {
UIkit.notification(i18next.t("notification_copy_success"), {
status: "success",
timeout: timeout,
});
});
clipboard.on("error", function (e: Error) {
UIkit.notification(
i18next.t("notification_copy_error", {
error: e.message,
}),
{
status: "danger",
timeout: timeout,
},
);
});
}