Add test push notification flow
This commit is contained in:
@@ -35,6 +35,15 @@ export async function deletePushSubscription(endpoint: string) {
|
||||
if (!response.ok) throw new Error("Unable to delete push subscription.");
|
||||
}
|
||||
|
||||
export async function sendTestPushNotification(endpoint: string) {
|
||||
const response = await fetch("/api/notifications/test", {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ endpoint }),
|
||||
});
|
||||
if (!response.ok) throw new Error("Unable to send test notification.");
|
||||
}
|
||||
|
||||
export function decodeBase64UrlKey(value: string) {
|
||||
const padding = "=".repeat((4 - (value.length % 4)) % 4);
|
||||
const base64 = `${value}${padding}`.replace(/-/g, "+").replace(/_/g, "/");
|
||||
|
||||
Reference in New Issue
Block a user