Skip to content

Commit

Permalink
portal/client: Fixed locution services, retrieve from company
Browse files Browse the repository at this point in the history
  • Loading branch information
rbatistadev authored and cruzccl committed Jan 8, 2025
1 parent 331effe commit ded715a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -53,7 +54,7 @@ const RecordingExtension: RecordingExtensionType = (

let code = '';
if (recordLocutionService !== null && serviceEnabled) {
code = `*${recordLocutionService.defaultCode}${values.id}`;
code = `*${recordLocutionService.code}${values.id}`;
}

return <span className={className}>{code}</span>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { AppStore } from '../index';
type NullableRecordType = Record<string, string | number> | null;

interface RecordLocutionServiceState {
loading: boolean;
serviceEnabled: Computed<RecordLocutionServiceState, boolean>;
recordLocutionService: NullableRecordType;
companyRecordLocutionService: NullableRecordType;
Expand All @@ -22,8 +21,6 @@ type loadCompanyRecordLocutionServiceProps = CancelTokenSourceProps & {

interface RecordLocutionServiceActions {
reset: Action<RecordLocutionServiceState, void>;
setLoading: Action<RecordLocutionServiceState, void>;
unsetLoading: Action<RecordLocutionServiceState, void>;
setRecordLocutionService: Action<
RecordLocutionServiceState,
NullableRecordType
Expand Down Expand Up @@ -51,7 +48,6 @@ export type RecordLocutionServiceStore = RecordLocutionServiceActions &

// TODO reset after a login
const recordLocutionService: RecordLocutionServiceStore = {
loading: false,
recordLocutionService: null,
companyRecordLocutionService: null,
serviceEnabled: computed<RecordLocutionServiceState, boolean>((state) => {
Expand All @@ -64,16 +60,9 @@ const recordLocutionService: RecordLocutionServiceStore = {
// Actions
///////////////////////////////
reset: action<RecordLocutionServiceState, void>((state) => {
state.loading = false;
state.recordLocutionService = null;
state.companyRecordLocutionService = null;
}),
setLoading: action<RecordLocutionServiceState, void>((state) => {
state.loading = true;
}),
unsetLoading: action<RecordLocutionServiceState, void>((state) => {
state.loading = false;
}),
setRecordLocutionService: action<
RecordLocutionServiceState,
NullableRecordType
Expand All @@ -90,14 +79,7 @@ const recordLocutionService: RecordLocutionServiceStore = {
// Thunks
///////////////////////////////
load: thunk<RecordLocutionServiceStore, CancelTokenSourceProps>(
async (actions, { cancelTokenSource }, { getState }) => {
const state = getState();
if (state.loading) {
return;
}

actions.setLoading();

async (actions, { cancelTokenSource }) => {
const recordLocutionService = await actions.loadRecordLocutionService({
cancelTokenSource,
});
Expand Down

0 comments on commit ded715a

Please sign in to comment.