Try converting subscription to json first
Test / test (push) Failing after 53s
Details
Test / test (push) Failing after 53s
Details
This commit is contained in:
parent
b966b30c06
commit
65185a4e9f
|
|
@ -146,9 +146,9 @@ export default function start(self: ServiceWorkerGlobalScope) {
|
|||
|
||||
const stupid =
|
||||
existingSubscriptionId === undefined
|
||||
? postSubscription(newSubscription, db)
|
||||
? postSubscription(newSubscription.toJSON(), db)
|
||||
: putSubscription(
|
||||
newSubscription,
|
||||
newSubscription.toJSON(),
|
||||
existingSubscriptionId.subscriptionId
|
||||
)
|
||||
await stupid
|
||||
|
|
@ -157,7 +157,7 @@ export default function start(self: ServiceWorkerGlobalScope) {
|
|||
}
|
||||
|
||||
async function postSubscription(
|
||||
subscription: PushSubscription,
|
||||
subscription: PushSubscriptionJSON,
|
||||
db: ReturnType<typeof database>
|
||||
) {
|
||||
await sendMessage({
|
||||
|
|
@ -191,7 +191,7 @@ export default function start(self: ServiceWorkerGlobalScope) {
|
|||
}
|
||||
}
|
||||
|
||||
function putSubscription(subscription: PushSubscription, id: number) {
|
||||
function putSubscription(subscription: PushSubscriptionJSON, id: number) {
|
||||
return fetch(`${process.env.BASE_URL}/api/subscription/${id}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(subscription),
|
||||
|
|
|
|||
Loading…
Reference in New Issue