MCPcopy Index your code
hub / github.com/coder/coder / unsubscribe

Function unsubscribe

site/src/contexts/useWebpushNotifications.ts:93–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91 };
92
93 const unsubscribe = async (): Promise<void> => {
94 try {
95 setLoading(true);
96 const registration = await navigator.serviceWorker.ready;
97 const subscription = await registration.pushManager.getSubscription();
98
99 if (subscription) {
100 await API.deleteWebPushSubscription("me", {
101 endpoint: subscription.endpoint,
102 });
103 await subscription.unsubscribe();
104 setSubscribed(false);
105 }
106 } catch (error) {
107 console.error("Unsubscription failed:", error);
108 throw error;
109 } finally {
110 setLoading(false);
111 }
112 };
113
114 return {
115 subscribed,

Callers 4

newAIBridgeDaemonFunction · 0.85
unsubscribeAllEntriesFunction · 0.85
handleWatchMethod · 0.85

Calls 1

unsubscribeMethod · 0.80

Tested by

no test coverage detected