From 6ecf3fc5596f87cb6e129098f1570523b32af4bd Mon Sep 17 00:00:00 2001 From: Ankit Date: Sun, 24 Nov 2024 21:52:13 +0530 Subject: [PATCH] fixed the issue --- components/GetNotification.tsx | 6 +++--- components/Job/Create/CreateForm.tsx | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/components/GetNotification.tsx b/components/GetNotification.tsx index 0ee20de..64ff414 100644 --- a/components/GetNotification.tsx +++ b/components/GetNotification.tsx @@ -78,15 +78,18 @@ export default function GetNotification() { async function subscribeUser(registration: ServiceWorkerRegistration) { try { if (!("Notification" in window)) { + console.log("notification error"); throw new Error("This browser does not support notifications"); } const permission = await Notification.requestPermission(); if (permission !== "granted") { + console.log("permission eror"); throw new Error("Notification permission denied"); } if (!("PushManager" in window)) { + console.log("pushmanager eror"); throw new Error("Push messaging is not supported"); } @@ -107,8 +110,6 @@ export default function GetNotification() { JSON.stringify(subcriptionObject), ); - console.log("response", response); - if (response.status !== 200) throw new Error(response.message); toast.success("Notification is enabled", { @@ -119,7 +120,6 @@ export default function GetNotification() { }, }); } catch (error) { - console.log("error in ctahc", error); toast.error((error as Error).message, { style: { backgroundColor: "red", diff --git a/components/Job/Create/CreateForm.tsx b/components/Job/Create/CreateForm.tsx index 2521d81..4211726 100755 --- a/components/Job/Create/CreateForm.tsx +++ b/components/Job/Create/CreateForm.tsx @@ -22,7 +22,6 @@ import { SelectValue, } from "@/components/ui/select"; import { Switch } from "@/components/ui/switch"; -import { SendNotification } from "@/app/actions/notification"; export default function CreateForm() { const { @@ -85,7 +84,6 @@ export default function CreateForm() { }, }); - await SendNotification(data.company); router.push("/jobs"); } catch (error) { toast((error as Error).message);