-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rename notification -> message
- Loading branch information
Showing
8 changed files
with
31 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
/// <reference types="node" /> | ||
|
||
import { buildPushPayload } from '../lib/main.js'; | ||
import { notification, subscription, vapid } from './shared.js'; | ||
import { message, subscription, vapid } from './shared.js'; | ||
|
||
declare let fetch: typeof import('undici').fetch; | ||
|
||
const init = await buildPushPayload(notification, subscription, vapid); | ||
const init = await buildPushPayload(message, subscription, vapid); | ||
const res = await fetch(subscription.endpoint, init); | ||
|
||
if (res.ok) { | ||
console.log(res.status, res.statusText, await res.text()); | ||
} else { | ||
throw new Error( | ||
`Push notification failed. HTTP ${res.status} ${res.statusText}}`, | ||
); | ||
throw new Error(`Push failed. HTTP ${res.status} ${res.statusText}}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters