Phase 0: Add frontend module config and update settings store
- Created modules.config.ts with module definitions - Added ModuleEnableSettings API functions - Updated settingsStore with module enable settings support - Added isModuleEnabled helper method
This commit is contained in:
@@ -1474,6 +1474,20 @@ export async function deleteAccountSetting(key: string): Promise<void> {
|
||||
}
|
||||
|
||||
// Module Settings
|
||||
export interface ModuleEnableSettings {
|
||||
id: number;
|
||||
planner_enabled: boolean;
|
||||
writer_enabled: boolean;
|
||||
thinker_enabled: boolean;
|
||||
automation_enabled: boolean;
|
||||
site_builder_enabled: boolean;
|
||||
linker_enabled: boolean;
|
||||
optimizer_enabled: boolean;
|
||||
publisher_enabled: boolean;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface ModuleSetting {
|
||||
id: number;
|
||||
module_name: string;
|
||||
@@ -1498,6 +1512,19 @@ export async function createModuleSetting(data: { module_name: string; key: stri
|
||||
});
|
||||
}
|
||||
|
||||
export async function fetchModuleEnableSettings(): Promise<ModuleEnableSettings> {
|
||||
const response = await fetchAPI('/v1/system/settings/modules/enable/');
|
||||
return response;
|
||||
}
|
||||
|
||||
export async function updateModuleEnableSettings(data: Partial<ModuleEnableSettings>): Promise<ModuleEnableSettings> {
|
||||
const response = await fetchAPI('/v1/system/settings/modules/enable/', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
export async function updateModuleSetting(moduleName: string, key: string, data: Partial<{ config: Record<string, any>; is_active: boolean }>): Promise<ModuleSetting> {
|
||||
return fetchAPI(`/v1/system/settings/modules/${key}/?module_name=${moduleName}`, {
|
||||
method: 'PUT',
|
||||
|
||||
Reference in New Issue
Block a user