Skip to content

Commit

Permalink
Create a global fix to create communicator if updateApiBoard make a post
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivm committed Apr 30, 2024
1 parent ba168fb commit 08821c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/Communicator/Communicator.actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,17 @@ export function createApiCommunicator(communicatorData, communicatorId) {
export function updateApiCommunicator(communicatorData) {
return dispatch => {
dispatch(updateApiCommunicatorStarted());

const LOCAL_COMMUNICATOR_ID = 'cboard_default';

const isLocalCommunicator =
communicatorData.id && communicatorData.id === LOCAL_COMMUNICATOR_ID;
return API.updateCommunicator(communicatorData)
.then(res => {
if (isLocalCommunicator) {
dispatch(createCommunicator({ ...communicatorData, ...res }));
dispatch(changeCommunicator(res.id));
}
dispatch(updateApiCommunicatorSuccess(res));
return res;
})
Expand Down

0 comments on commit 08821c6

Please sign in to comment.