summaryrefslogtreecommitdiffstats
path: root/ui/src/utils.ts
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-06-10 22:47:06 -0400
committerDessalines <tyhou13@gmx.com>2020-06-10 22:47:06 -0400
commit4cf1f080bf113d6e30383eb1fddd37ce16025558 (patch)
tree13f6c91876336a8869a77e2ebb55242a7b08807a /ui/src/utils.ts
parent2fbd44c59db9c94f7cd2055550066f429a19154b (diff)
Adding delete picture via pict-rs delete tokens. Fixes #505
Diffstat (limited to 'ui/src/utils.ts')
-rw-r--r--ui/src/utils.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/ui/src/utils.ts b/ui/src/utils.ts
index 2820bc48..570ea48c 100644
--- a/ui/src/utils.ts
+++ b/ui/src/utils.ts
@@ -487,6 +487,29 @@ export function toast(text: string, background: string = 'success') {
}).showToast();
}
+export function pictrsDeleteToast(
+ clickToDeleteText: string,
+ deletePictureText: string,
+ deleteUrl: string
+) {
+ let backgroundColor = `var(--light)`;
+ let toast = Toastify({
+ text: clickToDeleteText,
+ backgroundColor: backgroundColor,
+ gravity: 'top',
+ position: 'right',
+ duration: 0,
+ onClick: () => {
+ if (toast) {
+ window.location.replace(deleteUrl);
+ alert(deletePictureText);
+ toast.hideToast();
+ }
+ },
+ close: true,
+ }).showToast();
+}
+
export function messageToastify(
creator: string,
avatar: string,