mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
feat: add cache policy from settings
This commit is contained in:
parent
354a06af6d
commit
311d5fdc27
1 changed files with 3 additions and 2 deletions
|
@ -12,6 +12,7 @@ import type {
|
||||||
UserDetails,
|
UserDetails,
|
||||||
UserItem,
|
UserItem,
|
||||||
} from '@/types/core/data'
|
} from '@/types/core/data'
|
||||||
|
import { useSettings } from './useSettings'
|
||||||
|
|
||||||
function getNoDataMessage(key: DataKeys) {
|
function getNoDataMessage(key: DataKeys) {
|
||||||
return `No data in cache: you should query '${key}' before.`
|
return `No data in cache: you should query '${key}' before.`
|
||||||
|
@ -219,11 +220,11 @@ export function useCache<T extends any = any>(
|
||||||
| [StoreKeys, undefined]
|
| [StoreKeys, undefined]
|
||||||
| [StoreKeysParam, string]
|
| [StoreKeysParam, string]
|
||||||
const data = useData()
|
const data = useData()
|
||||||
// FIXME get global cache policy setting
|
const { cache } = useSettings()
|
||||||
// Add noCache arg? not used
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: computed(() => {
|
content: computed(() => {
|
||||||
|
if (!cache.value) return undefined
|
||||||
if (!(key in data)) {
|
if (!(key in data)) {
|
||||||
throw new Error('Trying to get cache of inexistant data')
|
throw new Error('Trying to get cache of inexistant data')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue