diff --git a/public/pages/EditFeatures/containers/EditFeatures.tsx b/public/pages/EditFeatures/containers/EditFeatures.tsx index 5ec09bb2..550c9042 100644 --- a/public/pages/EditFeatures/containers/EditFeatures.tsx +++ b/public/pages/EditFeatures/containers/EditFeatures.tsx @@ -289,7 +289,7 @@ export function EditFeatures(props: EditFeaturesProps) { } else { setSaveFeatureOption(SAVE_FEATURE_OPTIONS.START_AD_JOB); } - if (errors.categoryField) { + if (isHCDetector && errors.categoryField) { focusOnCategoryField(); return; } diff --git a/public/redux/middleware/__tests__/clientMiddleware.test.ts b/public/redux/middleware/__tests__/clientMiddleware.test.ts index d2e89035..9f821cdf 100644 --- a/public/redux/middleware/__tests__/clientMiddleware.test.ts +++ b/public/redux/middleware/__tests__/clientMiddleware.test.ts @@ -92,12 +92,12 @@ describe('client MiddleWare', () => { const { next, invoke } = create(); const actionCall = jest .fn() - .mockReturnValue(fooPromise(true, { ok: false })); + .mockReturnValue(fooPromise(true, { body: { ok: false } })); const action = { type: 'TEST', request: actionCall }; return invoke(action).then(() => { expect(next.mock.calls.length).toBe(2); expect(next.mock.calls[1][0]).toEqual({ - result: { ok: false }, + result: { body: { ok: false } }, type: 'TEST_SUCCESS', }); }); diff --git a/public/redux/middleware/clientMiddleware.ts b/public/redux/middleware/clientMiddleware.ts index 805e6116..3175337c 100644 --- a/public/redux/middleware/clientMiddleware.ts +++ b/public/redux/middleware/clientMiddleware.ts @@ -41,12 +41,12 @@ export default function clientMiddleware(client: HttpSetup) { next({ ...rest, type: `${type}_REQUEST` }); const result = await request(client); //@ts-ignore - if (get(result, 'data.ok', true)) { + if (get(result, 'ok', true)) { next({ ...rest, result, type: `${type}_SUCCESS` }); return result; } else { //@ts-ignore - throw get(result, 'data.error', ''); + throw get(result, 'error', ''); } } catch (error) { next({ ...rest, error, type: `${type}_FAILURE` });