Skip to content

Commit

Permalink
Merge pull request #44 from Kashyap1ankit/fix/hero
Browse files Browse the repository at this point in the history
fixed the issue
  • Loading branch information
Kashyap1ankit authored Nov 24, 2024
2 parents c34ff02 + e837fd0 commit eb28a21
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions components/GetNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export default function GetNotification() {
);
}
} catch (error) {
console.log("1");
toast((error as Error).message);
} finally {
setRefetch((prev) => !prev);
Expand All @@ -72,7 +71,6 @@ export default function GetNotification() {
await subscribeUser(registration);
}
} catch (error) {
console.log("1-2");
toast((error as Error).message);
}
}
Expand Down Expand Up @@ -103,10 +101,14 @@ export default function GetNotification() {

const subcriptionObject =
await registration.pushManager.subscribe(option);
console.log("subs model", subcriptionObject);

const response = await addNotificationSubscription(
JSON.stringify(subcriptionObject),
);

console.log("response", response);

if (response.status !== 200) throw new Error(response.message);

toast.success("Notification is enabled", {
Expand All @@ -117,7 +119,7 @@ export default function GetNotification() {
},
});
} catch (error) {
console.log("1-3");
console.log("error in ctahc", error);
toast.error((error as Error).message, {
style: {
backgroundColor: "red",
Expand Down

0 comments on commit eb28a21

Please sign in to comment.