Add DESTROY_RESOURCE_START action
parent
90b65ab5c6
commit
2010f6efbd
|
@ -194,8 +194,14 @@ export const destroyCatch = (p: DestroyNoProps) => (err: UnsafeError) => {
|
|||
return Promise.reject(err);
|
||||
};
|
||||
|
||||
/** We need this to detect read-only deletion attempts */
|
||||
function destroyStart() {
|
||||
return { type: Actions.DESTROY_RESOURCE_START, payload: {} };
|
||||
}
|
||||
|
||||
export function destroy(uuid: string, force = false) {
|
||||
return function (dispatch: Function, getState: GetState) {
|
||||
dispatch(destroyStart());
|
||||
/** Stop user from deleting resources if app is read only. */
|
||||
if (appIsReadonly(getState().resources.index)) {
|
||||
return Promise.reject("Application is in read-only mode.");
|
||||
|
|
|
@ -893,6 +893,7 @@ export namespace DiagnosticMessages {
|
|||
export enum Actions {
|
||||
|
||||
// Resources
|
||||
DESTROY_RESOURCE_START = "DESTROY_RESOURCE_START",
|
||||
DESTROY_RESOURCE_OK = "DESTROY_RESOURCE_OK",
|
||||
INIT_RESOURCE = "INIT_RESOURCE",
|
||||
BATCH_INIT = "BATCH_INIT",
|
||||
|
|
|
@ -275,6 +275,7 @@ export const beforeEach = (state: RestResources,
|
|||
return state;
|
||||
}
|
||||
case Actions.SAVE_RESOURCE_START:
|
||||
case Actions.DESTROY_RESOURCE_START:
|
||||
if (kind !== "WebAppConfig") {
|
||||
// User is trying to make HTTP requests.
|
||||
fail("3");
|
||||
|
|
Loading…
Reference in New Issue