aboutsummaryrefslogtreecommitdiffstats
path: root/site
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-10-03 13:18:47 -0700
committerPinapelz <yukais@pinapelz.com>2025-10-03 13:18:47 -0700
commit4da231aeb5bf3ee0296fb8626dae3ac99893a158 (patch)
treee952d79fe1c6f2ef6b7f65ac43b409ec4a7474b9 /site
parent78aa1512446072fdec94c86360c9aee3ea932db1 (diff)
implement api call to save topic for given fcm token
Diffstat (limited to 'site')
-rw-r--r--site/src/components/NotificationButton.tsx11
1 files changed, 9 insertions, 2 deletions
diff --git a/site/src/components/NotificationButton.tsx b/site/src/components/NotificationButton.tsx
index 3e0342b..1e9bc5e 100644
--- a/site/src/components/NotificationButton.tsx
+++ b/site/src/components/NotificationButton.tsx
@@ -75,7 +75,10 @@ export default function NotificationButton({ className = "", isMoe = false, game
// TODO: Subscribe to topic via backend API
console.log(`Subscribing to topic: ${gameId} with token: ${token}`);
- // Stub for now - will make actual API call to backend to subscribe to topic
+ await fetch(import.meta.env.VITE_MIDDLEWARE_BASE_URL+`/api/notifications/set?topic=${gameId}&token=${token}&action=subscribe`, {
+ method: "GET",
+ headers: { "Content-Type": "application/json" },
+ });
// Update local storage to track subscribed topics
const subscribedTopics = JSON.parse(localStorage.getItem('subscribed_topics') || '[]');
@@ -106,7 +109,11 @@ export default function NotificationButton({ className = "", isMoe = false, game
// TODO: Unsubscribe from topic via backend API
console.log(`Unsubscribing from topic: ${gameId} with token: ${token}`);
- // Stub for now - will make actual API call to backend to unsubscribe from topic
+ await fetch(import.meta.env.VITE_MIDDLEWARE_BASE_URL+`/api/notifications/set?topic=${gameId}&token=${token}&action=unsubscribe`, {
+ method: "GET",
+ headers: { "Content-Type": "application/json" },
+ });
+
// Update local storage to remove topic
const subscribedTopics = JSON.parse(localStorage.getItem('subscribed_topics') || '[]');
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage