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

@ -20,7 +20,7 @@ const languageFileMap = import.meta.glob(['./*.json', '!./en.json'])
const loadLanguageFile = (code) => { const loadLanguageFile = (code) => {
const jsonName = langCodeToJsonName(code) const jsonName = langCodeToJsonName(code)
if (jsonName === 'en') return Promise.resolve({ default: enMessages }) if (jsonName === 'en') return { default: enMessages }
return languageFileMap[`./${jsonName}.json`]() return languageFileMap[`./${jsonName}.json`]()
} }

View file

@ -76,10 +76,10 @@ const mergeArrayLength = (oldValue, newValue) => {
const getNotificationPermission = () => { const getNotificationPermission = () => {
const Notification = window.Notification const Notification = window.Notification
if (!Notification) return Promise.resolve(null) if (!Notification) return null
if (Notification.permission === 'default') if (Notification.permission === 'default')
return Notification.requestPermission() return Notification.requestPermission()
return Promise.resolve(Notification.permission) return Notification.permission
} }
const blockUser = (store, args) => { const blockUser = (store, args) => {
@ -388,7 +388,7 @@ const users = {
if (!user) { if (!user) {
return store.dispatch('fetchUser', id) return store.dispatch('fetchUser', id)
} else { } else {
return Promise.resolve(user) return user
} }
}, },
updateUserAdminData(store, { userAdminData }) { updateUserAdminData(store, { userAdminData }) {

View file

@ -316,7 +316,7 @@ export const getResourcesIndex = async (url, parser = (x) => x) => {
const resourceTransform = (resources) => { const resourceTransform = (resources) => {
return Object.entries(resources).map(([k, v]) => { return Object.entries(resources).map(([k, v]) => {
if (typeof v === 'object') { if (typeof v === 'object') {
return [k, () => Promise.resolve(v)] return [k, () => v]
} else if (typeof v === 'string') { } else if (typeof v === 'string') {
return [ return [
k, k,
@ -361,5 +361,5 @@ export const getResourcesIndex = async (url, parser = (x) => x) => {
if (total.length === 0) { if (total.length === 0) {
throw new Error(`Resource at ${url} and ${customUrl} completely unavailable. Panicking`) 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) return registration.pushManager.subscribe(subscribeOptions)
} }
function unsubscribePush(registration) { async function unsubscribePush(registration) {
return registration.pushManager.getSubscription().then((subscription) => { return registration.pushManager.getSubscription().then((subscription) => {
if (subscription === null) { if (subscription === null) {
return Promise.resolve('No subscription') return 'No subscription'
} }
return subscription.unsubscribe() return subscription.unsubscribe()
}) })

View file

@ -294,7 +294,7 @@ export const useInterfaceStore = defineStore('interface', {
path: 'palettesIndex', path: 'palettesIndex',
value: { _error: e }, value: { _error: e },
}) })
return Promise.resolve({}) return {}
} }
}, },
setPalette(value) { setPalette(value) {
@ -332,7 +332,7 @@ export const useInterfaceStore = defineStore('interface', {
path: 'simple.stylesIndex', path: 'simple.stylesIndex',
value: { _error: e }, value: { _error: e },
}) })
return Promise.resolve({}) return {}
} }
}, },
setStyle(value) { setStyle(value) {
@ -375,7 +375,7 @@ export const useInterfaceStore = defineStore('interface', {
path: 'themesIndex', path: 'themesIndex',
value: { _error: e }, value: { _error: e },
}) })
return Promise.resolve({}) return {}
} }
}, },
setTheme(value) { setTheme(value) {