feat(backend): switch to toasts for client-side API feedback, flesh out edit profile page

This commit is contained in:
Sam 2022-11-21 03:20:15 +01:00
parent 8ab4c2a91b
commit 373ccf4b63
6 changed files with 77 additions and 29 deletions

29
frontend/lib/toast.ts Normal file
View file

@ -0,0 +1,29 @@
import Toastify from "toastify-js";
import "toastify-js/src/toastify.css";
export default function toast(options: { text: string; background?: string }) {
let background: string;
switch (options.background) {
case "error":
background = "#A1081F";
break;
case "success":
background = "#1D611A";
break;
default:
background = "#4F5859";
break;
}
Toastify({
text: options.text,
gravity: "top",
position: "left",
duration: -1,
close: true,
style: {
background: background,
color: "#FFFFFF",
},
}).showToast();
}