import { isCategoryDefinition } from '../apps/settings/utils';
import { getJSON, post, postJSON, RequestData } from '../helpers/request';
import { BranchParameters } from '../types/branch-like';
-import { SettingCategoryDefinition, SettingDefinition, SettingValue } from '../types/settings';
+import {
+ SettingCategoryDefinition,
+ SettingDefinition,
+ SettingValue,
+ SettingValueResponse
+} from '../types/settings';
export function getDefinitions(component?: string): Promise<SettingCategoryDefinition[]> {
return getJSON('/api/settings/list_definitions', { component }).then(
export function getValues(
data: { keys: string; component?: string } & BranchParameters
): Promise<SettingValue[]> {
- return getJSON('/api/settings/values', data).then(r => r.settings);
+ return getJSON('/api/settings/values', data).then((r: SettingValueResponse) => [
+ ...r.settings,
+ ...r.setSecuredSettings.map(key => ({ key }))
+ ]);
}
export function setSettingValue(
subCategory: string;
}
+export interface SettingValueResponse {
+ settings: SettingValue[];
+ setSecuredSettings: string[];
+}
+
export interface SettingValue {
fieldValues?: Array<T.Dict<string>>;
inherited?: boolean;