1 import { isBrowser } from "@utils/browser";
2 import { ThemeColor } from "@utils/types";
3 import Toastify from "toastify-js";
4 import { I18NextService } from "./services";
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 = I18NextService.i18n.t("click_to_delete_picture", {
24 const deletePictureText = I18NextService.i18n.t("picture_deleted", {
27 const failedDeletePictureText = I18NextService.i18n.t(
28 "failed_to_delete_picture",
34 const backgroundColor = `var(--bs-light)`;
36 const toast = Toastify({
37 text: clickToDeleteText,
38 backgroundColor: backgroundColor,
44 fetch(deleteUrl).then(res => {
46 if (res.ok === true) {
47 alert(deletePictureText);
49 alert(failedDeletePictureText);