LogoutModel.ets 663 Bytes
import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork';

export class LogoutModel{

  requestLogout(){
    let bean: Record<string, string> = {};
    bean['refreshToken'] = HttpUrlUtils.getRefreshToken()
    return new Promise<string>((success, fail) => {
      HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.accountLogoutUrl(), bean).then((data: ResponseDTO<string>) => {
        if (!data) {
          fail("数据为空")
          return
        }
        if (data.code != 0) {
          fail(data.message)
          return
        }
        success(data.message)
      }, (error: Error) => {
        fail(error.message)
      })
    })
  }

}