1 import { isBrowser } from "@utils/browser";
2 import { ThemeColor } from "@utils/types";
3 import Toastify from "toastify-js";
4 import { i18n } from "./i18next";
6 export function toast(text: string, background: ThemeColor = "success") {
8 const backgroundColor = `var(--bs-${background})`;
11 backgroundColor: backgroundColor,
19 export function pictrsDeleteToast(filename: string, deleteUrl: string) {
21 const clickToDeleteText = i18n.t("click_to_delete_picture", { filename });
22 const deletePictureText = i18n.t("picture_deleted", {
25 const failedDeletePictureText = i18n.t("failed_to_delete_picture", {
29 const backgroundColor = `var(--bs-light)`;
31 const toast = Toastify({
32 text: clickToDeleteText,
33 backgroundColor: backgroundColor,
39 fetch(deleteUrl).then(res => {
41 if (res.ok === true) {
42 alert(deletePictureText);
44 alert(failedDeletePictureText);