let textarea: any = document.getElementById(i.id);
autosize.update(textarea);
pictrsDeleteToast(
- i18n.t("click_to_delete_picture"),
- i18n.t("picture_deleted"),
+ i18n.t("click_to_delete_picture").concat('\n(', file.name,')'),
+ i18n.t("picture_deleted").concat('\n(', file.name,')'),
+ i18n.t("fail_picture_deleted").concat('\n(', file.name,')'),
deleteUrl
);
} else {
export function pictrsDeleteToast(
clickToDeleteText: string,
deletePictureText: string,
+ failedDeletePictureText: string,
deleteUrl: string
) {
if (isBrowser()) {
duration: 10000,
onClick: () => {
if (toast) {
- window.location.replace(deleteUrl);
- alert(deletePictureText);
- toast.hideToast();
+ fetch(deleteUrl, {})
+ .then( res => {
+ console.log(res)
+ toast.hideToast();
+ if (res.ok === true){
+ alert(deletePictureText);
+ } else{
+ alert(failedDeletePictureText);
+ }
+ })
}
},
close: true,