BREAKING CHANGE(config): convert configuration management to read-only; remove updateConfiguration endpoint and client-side editing
This commit is contained in:
@@ -267,17 +267,17 @@ export const fetchAllStatsAction = statsStatePart.createAction(async (statePartA
|
||||
}
|
||||
});
|
||||
|
||||
// Fetch Configuration Action
|
||||
// Fetch Configuration Action (read-only)
|
||||
export const fetchConfigurationAction = configStatePart.createAction(async (statePartArg) => {
|
||||
const context = getActionContext();
|
||||
|
||||
|
||||
const currentState = statePartArg.getState();
|
||||
|
||||
try {
|
||||
const configRequest = new plugins.domtools.plugins.typedrequest.TypedRequest<
|
||||
interfaces.requests.IReq_GetConfiguration
|
||||
>('/typedrequest', 'getConfiguration');
|
||||
|
||||
|
||||
const response = await configRequest.fire({
|
||||
identity: context.identity,
|
||||
});
|
||||
@@ -296,35 +296,6 @@ export const fetchConfigurationAction = configStatePart.createAction(async (stat
|
||||
}
|
||||
});
|
||||
|
||||
// Update Configuration Action
|
||||
export const updateConfigurationAction = configStatePart.createAction<{
|
||||
section: string;
|
||||
config: any;
|
||||
}>(async (statePartArg, dataArg) => {
|
||||
const context = getActionContext();
|
||||
if (!context.identity) {
|
||||
throw new Error('Must be logged in to update configuration');
|
||||
}
|
||||
|
||||
const updateRequest = new plugins.domtools.plugins.typedrequest.TypedRequest<
|
||||
interfaces.requests.IReq_UpdateConfiguration
|
||||
>('/typedrequest', 'updateConfiguration');
|
||||
|
||||
const response = await updateRequest.fire({
|
||||
identity: context.identity,
|
||||
section: dataArg.section,
|
||||
config: dataArg.config,
|
||||
});
|
||||
|
||||
if (response.updated) {
|
||||
// Refresh configuration
|
||||
await configStatePart.dispatchAction(fetchConfigurationAction, null);
|
||||
return statePartArg.getState();
|
||||
}
|
||||
|
||||
return statePartArg.getState();
|
||||
});
|
||||
|
||||
// Fetch Recent Logs Action
|
||||
export const fetchRecentLogsAction = logStatePart.createAction<{
|
||||
limit?: number;
|
||||
|
||||
Reference in New Issue
Block a user