diff --git a/web/portal/client/src/entities/Locution/Field/RecordingExtension.tsx b/web/portal/client/src/entities/Locution/Field/RecordingExtension.tsx index 617615b9ae2..294dc22a6e7 100644 --- a/web/portal/client/src/entities/Locution/Field/RecordingExtension.tsx +++ b/web/portal/client/src/entities/Locution/Field/RecordingExtension.tsx @@ -43,7 +43,8 @@ const RecordingExtension: RecordingExtensionType = ( }, [recordLocutionServiceLoader, cancelTokenSource]); const recordLocutionService = useStoreState( - (state) => state.clientSession.recordLocutionService.recordLocutionService + (state) => + state.clientSession.recordLocutionService.companyRecordLocutionService ); const serviceEnabled = useStoreState( (state) => state.clientSession.recordLocutionService.serviceEnabled @@ -53,7 +54,7 @@ const RecordingExtension: RecordingExtensionType = ( let code = ''; if (recordLocutionService !== null && serviceEnabled) { - code = `*${recordLocutionService.defaultCode}${values.id}`; + code = `*${recordLocutionService.code}${values.id}`; } return {code}; diff --git a/web/portal/client/src/store/clientSession/recordLocutionService.ts b/web/portal/client/src/store/clientSession/recordLocutionService.ts index 65239482a25..e2eb7d25ccf 100644 --- a/web/portal/client/src/store/clientSession/recordLocutionService.ts +++ b/web/portal/client/src/store/clientSession/recordLocutionService.ts @@ -6,7 +6,6 @@ import { AppStore } from '../index'; type NullableRecordType = Record | null; interface RecordLocutionServiceState { - loading: boolean; serviceEnabled: Computed; recordLocutionService: NullableRecordType; companyRecordLocutionService: NullableRecordType; @@ -22,8 +21,6 @@ type loadCompanyRecordLocutionServiceProps = CancelTokenSourceProps & { interface RecordLocutionServiceActions { reset: Action; - setLoading: Action; - unsetLoading: Action; setRecordLocutionService: Action< RecordLocutionServiceState, NullableRecordType @@ -51,7 +48,6 @@ export type RecordLocutionServiceStore = RecordLocutionServiceActions & // TODO reset after a login const recordLocutionService: RecordLocutionServiceStore = { - loading: false, recordLocutionService: null, companyRecordLocutionService: null, serviceEnabled: computed((state) => { @@ -64,16 +60,9 @@ const recordLocutionService: RecordLocutionServiceStore = { // Actions /////////////////////////////// reset: action((state) => { - state.loading = false; state.recordLocutionService = null; state.companyRecordLocutionService = null; }), - setLoading: action((state) => { - state.loading = true; - }), - unsetLoading: action((state) => { - state.loading = false; - }), setRecordLocutionService: action< RecordLocutionServiceState, NullableRecordType @@ -90,14 +79,7 @@ const recordLocutionService: RecordLocutionServiceStore = { // Thunks /////////////////////////////// load: thunk( - async (actions, { cancelTokenSource }, { getState }) => { - const state = getState(); - if (state.loading) { - return; - } - - actions.setLoading(); - + async (actions, { cancelTokenSource }) => { const recordLocutionService = await actions.loadRecordLocutionService({ cancelTokenSource, });