X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/fbbc53779fb3adf15d70936477aab771ee7caf42..b1a6da4a288560a87e0e38ad2fd73fb227e3fc66:/src/store/collections/collection-create-actions.ts diff --git a/src/store/collections/collection-create-actions.ts b/src/store/collections/collection-create-actions.ts index f4375688..8d1e9ba5 100644 --- a/src/store/collections/collection-create-actions.ts +++ b/src/store/collections/collection-create-actions.ts @@ -3,7 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import { Dispatch } from "redux"; -import { reset, startSubmit, stopSubmit, initialize } from 'redux-form'; +import { reset, startSubmit, stopSubmit, initialize, FormErrors } from 'redux-form'; import { RootState } from '~/store/store'; import { dialogActions } from "~/store/dialog/dialog-actions"; import { ServiceRepository } from '~/services/services'; @@ -40,7 +40,7 @@ export const openCollectionCreateDialog = (ownerUuid: string) => export const createCollection = (data: CollectionCreateFormDialogData) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { dispatch(startSubmit(COLLECTION_CREATE_FORM_NAME)); - let newCollection: CollectionResource | null = null; + let newCollection: CollectionResource; try { dispatch(progressIndicatorActions.START_WORKING(COLLECTION_CREATE_FORM_NAME)); newCollection = await services.collectionService.create(data); @@ -52,7 +52,7 @@ export const createCollection = (data: CollectionCreateFormDialogData) => } catch (e) { const error = getCommonResourceServiceError(e); if (error === CommonResourceServiceError.UNIQUE_VIOLATION) { - dispatch(stopSubmit(COLLECTION_CREATE_FORM_NAME, { name: 'Collection with the same name already exists.' })); + dispatch(stopSubmit(COLLECTION_CREATE_FORM_NAME, { name: 'Collection with the same name already exists.' } as FormErrors)); } else if (error === CommonResourceServiceError.NONE) { dispatch(stopSubmit(COLLECTION_CREATE_FORM_NAME)); dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_CREATE_FORM_NAME }));