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 =
|
const stupid =
|
||||||
existingSubscriptionId === undefined
|
existingSubscriptionId === undefined
|
||||||
? postSubscription(newSubscription, db)
|
? postSubscription(newSubscription.toJSON(), db)
|
||||||
: putSubscription(
|
: putSubscription(
|
||||||
newSubscription,
|
newSubscription.toJSON(),
|
||||||
existingSubscriptionId.subscriptionId
|
existingSubscriptionId.subscriptionId
|
||||||
)
|
)
|
||||||
await stupid
|
await stupid
|
||||||
|
|
@ -157,7 +157,7 @@ export default function start(self: ServiceWorkerGlobalScope) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function postSubscription(
|
async function postSubscription(
|
||||||
subscription: PushSubscription,
|
subscription: PushSubscriptionJSON,
|
||||||
db: ReturnType<typeof database>
|
db: ReturnType<typeof database>
|
||||||
) {
|
) {
|
||||||
await sendMessage({
|
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}`, {
|
return fetch(`${process.env.BASE_URL}/api/subscription/${id}`, {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
body: JSON.stringify(subscription),
|
body: JSON.stringify(subscription),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue