Updated on 2024-07-30 GMT+08:00

Scenario 11: Logout

Description

You can call this API to log out of Huawei Cloud Meeting.

Service Process

When using the SDK to log out, call the logout API and implement the API callback function onLogoutResult.

  1. Call the API.

    1. Assemble the API callback function onLogoutResult.
    2. Call the Logout API to log out. The data in the preceding step is used as input parameters.

  2. Implement the callback function.

    Implement the onLogoutResult function.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
/**
* Log out.
*/
async Logout(){
    const apiService = new ApiService();
    let setResult = await apiService.logout();
    if(setResult.ret === 0){
        console.log("logoutresult:", setResult.logoutResult);
        window.sessionStorage.setItem("confListInfo", "");
        this.props.history.push('/');
    }else{
        window.electron.ipcRenderer.send("show-error-alert", "logout error = " + setResult.ret);
    }
}

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
/**
* Definition of logout API in ApiService
*/
async logout() {
  return new Promise((resolve) => {
    let resultCallback = (ret, reason, logoutResult) => {
      console.log("logout, out data = ", { ret, reason, logoutResult });
      resolve({ ret, reason, logoutResult });
    };
    console.log("logout, in param = ");
    this.uisdkService.getLoginApi().logout(resultCallback);
  });
}