more promises
This commit is contained in:
parent
11054bdad7
commit
03ef01672e
5 changed files with 11 additions and 11 deletions
|
|
@ -316,7 +316,7 @@ export const getResourcesIndex = async (url, parser = (x) => x) => {
|
|||
const resourceTransform = (resources) => {
|
||||
return Object.entries(resources).map(([k, v]) => {
|
||||
if (typeof v === 'object') {
|
||||
return [k, () => Promise.resolve(v)]
|
||||
return [k, () => v]
|
||||
} else if (typeof v === 'string') {
|
||||
return [
|
||||
k,
|
||||
|
|
@ -361,5 +361,5 @@ export const getResourcesIndex = async (url, parser = (x) => x) => {
|
|||
if (total.length === 0) {
|
||||
throw new Error(`Resource at ${url} and ${customUrl} completely unavailable. Panicking`)
|
||||
}
|
||||
return Promise.resolve(Object.fromEntries(total))
|
||||
return Object.fromEntries(total)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ function subscribePush(registration, isEnabled, vapidPublicKey) {
|
|||
return registration.pushManager.subscribe(subscribeOptions)
|
||||
}
|
||||
|
||||
function unsubscribePush(registration) {
|
||||
async function unsubscribePush(registration) {
|
||||
return registration.pushManager.getSubscription().then((subscription) => {
|
||||
if (subscription === null) {
|
||||
return Promise.resolve('No subscription')
|
||||
return 'No subscription'
|
||||
}
|
||||
return subscription.unsubscribe()
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue