refactor(config): add PRO_FEATURE constants for licensed features
This commit is contained in:
parent
4a558fc57a
commit
565bf97294
|
|
@ -0,0 +1,8 @@
|
|||
// Licensed "pro" features the server may advertise via /info's enabled_pro_features.
|
||||
// Use these instead of bare strings when calling configStore.isProFeatureEnabled.
|
||||
export const PRO_FEATURE = {
|
||||
ADMIN_PANEL: 'admin_panel',
|
||||
TIME_TRACKING: 'time_tracking',
|
||||
} as const
|
||||
|
||||
export type ProFeature = typeof PRO_FEATURE[keyof typeof PRO_FEATURE]
|
||||
|
|
@ -7,6 +7,7 @@ import {objectToCamelCase} from '@/helpers/case'
|
|||
|
||||
import type {IProvider} from '@/types/IProvider'
|
||||
import type {MIGRATORS} from '@/views/migrate/migrators'
|
||||
import type {ProFeature} from '@/constants/proFeatures'
|
||||
import {InvalidApiUrlProvidedError} from '@/helpers/checkAndSetApiUrl'
|
||||
|
||||
export interface ConfigState {
|
||||
|
|
@ -104,7 +105,7 @@ export const useConfigStore = defineStore('config', () => {
|
|||
Object.assign(state, config)
|
||||
}
|
||||
|
||||
function isProFeatureEnabled(name: string): boolean {
|
||||
function isProFeatureEnabled(name: ProFeature): boolean {
|
||||
return state.enabledProFeatures?.includes(name) ?? false
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue