Show errors in UI

This commit is contained in:
Nicolas Mowen 2024-07-22 14:25:36 -06:00
parent 61f4bcdcdf
commit 273e7c07d1

View File

@ -74,8 +74,17 @@ export default function NotificationView({
applicationServerKey: publicKey,
})
.then((pushSubscription) => {
axios.post("notifications/register", {
axios
.post("notifications/register", {
sub: pushSubscription,
})
.catch(() => {
toast.error("Failed to save notification registration.", {
position: "top-center",
});
pushSubscription.unsubscribe();
registration.unregister();
setRegistration(null);
});
toast.success(
"Successfully registered for notifications. Restart to start receiving notifications.",