more promises

This commit is contained in:
Henry Jameson 2026-08-04 21:06:38 +03:00
commit 03ef01672e
5 changed files with 11 additions and 11 deletions

View file

@ -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)
}

View file

@ -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()
})