Skip to content

Commit

Permalink
[FIX] Broken build caused by PRs modifying same file differently(#24863)
Browse files Browse the repository at this point in the history
Co-authored-by: Tiago Evangelista Pinto <tiago.evangelista@rocket.chat>
  • Loading branch information
2 people authored and AllanPazRibeiro committed Mar 18, 2022
1 parent 407bb8f commit a3c8bbd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions client/providers/CallProvider/hooks/useVoipClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ export const useVoipClient = (): UseVoipClientResult => {
callServerConfig: { websocketPath },
} = parsedData;

// let client: VoIPUser;
(async (): Promise<void> => {
try {
const subscription = await membership({ extension });
client = await SimpleVoipUser.create(extension, password, host, websocketPath, iceServers, 'video');
// Today we are hardcoding workflow mode.
// In futue, this should be read from configuration
// In future, this should be ready from configuration
client.setWorkflowMode(WorkflowTypes.CONTACT_CENTER_USER);
client.setMembershipSubscription(subscription);
setResult({ voipClient: client, registrationInfo: parsedData });
Expand All @@ -71,8 +70,6 @@ export const useVoipClient = (): UseVoipClientResult => {
},
);
return (): void => {
// client?.disconnect();
// TODO how to close the client? before creating a new one?
if (client) {
client.clear();
}
Expand All @@ -88,10 +85,12 @@ export const useVoipClient = (): UseVoipClientResult => {
setExtension(user.extension);
} else {
setExtension(null);
if (!isUseVoipClientResultError(result) && !isUseVoipClientResultLoading(result)) {
const { voipClient } = result as UseVoipClientResultResolved;
voipClient.clear();

if (!result.voipClient) {
return;
}

result.voipClient.clear();
}
}, [result, setExtension, setResult, user]);
return result;
Expand Down

0 comments on commit a3c8bbd

Please sign in to comment.