more promises
This commit is contained in:
parent
11054bdad7
commit
03ef01672e
5 changed files with 11 additions and 11 deletions
|
|
@ -20,7 +20,7 @@ const languageFileMap = import.meta.glob(['./*.json', '!./en.json'])
|
|||
|
||||
const loadLanguageFile = (code) => {
|
||||
const jsonName = langCodeToJsonName(code)
|
||||
if (jsonName === 'en') return Promise.resolve({ default: enMessages })
|
||||
if (jsonName === 'en') return { default: enMessages }
|
||||
return languageFileMap[`./${jsonName}.json`]()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,10 +76,10 @@ const mergeArrayLength = (oldValue, newValue) => {
|
|||
const getNotificationPermission = () => {
|
||||
const Notification = window.Notification
|
||||
|
||||
if (!Notification) return Promise.resolve(null)
|
||||
if (!Notification) return null
|
||||
if (Notification.permission === 'default')
|
||||
return Notification.requestPermission()
|
||||
return Promise.resolve(Notification.permission)
|
||||
return Notification.permission
|
||||
}
|
||||
|
||||
const blockUser = (store, args) => {
|
||||
|
|
@ -388,7 +388,7 @@ const users = {
|
|||
if (!user) {
|
||||
return store.dispatch('fetchUser', id)
|
||||
} else {
|
||||
return Promise.resolve(user)
|
||||
return user
|
||||
}
|
||||
},
|
||||
updateUserAdminData(store, { userAdminData }) {
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ export const useInterfaceStore = defineStore('interface', {
|
|||
path: 'palettesIndex',
|
||||
value: { _error: e },
|
||||
})
|
||||
return Promise.resolve({})
|
||||
return {}
|
||||
}
|
||||
},
|
||||
setPalette(value) {
|
||||
|
|
@ -332,7 +332,7 @@ export const useInterfaceStore = defineStore('interface', {
|
|||
path: 'simple.stylesIndex',
|
||||
value: { _error: e },
|
||||
})
|
||||
return Promise.resolve({})
|
||||
return {}
|
||||
}
|
||||
},
|
||||
setStyle(value) {
|
||||
|
|
@ -375,7 +375,7 @@ export const useInterfaceStore = defineStore('interface', {
|
|||
path: 'themesIndex',
|
||||
value: { _error: e },
|
||||
})
|
||||
return Promise.resolve({})
|
||||
return {}
|
||||
}
|
||||
},
|
||||
setTheme(value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue