shishuangxi

注销bug处理

1 import HashMap from '@ohos.util.HashMap'; 1 import HashMap from '@ohos.util.HashMap';
2 -import { UserDataLocal } from 'wdKit/Index';  
3 -import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';  
4 -import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; 2 +import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork';
5 3
6 export class LogoutModel{ 4 export class LogoutModel{
7 5
8 requestLogout(){ 6 requestLogout(){
9 let bean: Record<string, string> = {}; 7 let bean: Record<string, string> = {};
10 bean['refreshToken'] = HttpUrlUtils.getRefreshToken() 8 bean['refreshToken'] = HttpUrlUtils.getRefreshToken()
11 - bean['refreshToken'] = 'ddrqreeee'  
12 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 9 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
13 return new Promise<string>((success, fail) => { 10 return new Promise<string>((success, fail) => {
14 - HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.accountLogoutUrl(), bean, headers).then((data: ResponseDTO<string>) => { 11 + HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.accountLogoutUrl(), bean, headers).then((data: ResponseDTO<string>) => {
15 if (!data) { 12 if (!data) {
16 fail("数据为空") 13 fail("数据为空")
17 return 14 return
@@ -23,7 +20,6 @@ export class LogoutModel{ @@ -23,7 +20,6 @@ export class LogoutModel{
23 success(data.message) 20 success(data.message)
24 }, (error: Error) => { 21 }, (error: Error) => {
25 fail(error.message) 22 fail(error.message)
26 - // Logger.debug("LoginViewModel:error ", error.toString())  
27 }) 23 })
28 }) 24 })
29 } 25 }
1 import { SpConstants } from 'wdConstant/Index' 1 import { SpConstants } from 'wdConstant/Index'
2 -import { SPHelper } from 'wdKit/Index' 2 +import { SPHelper, UserDataLocal } from 'wdKit/Index'
3 import { HttpUrlUtils } from 'wdNetwork/Index' 3 import { HttpUrlUtils } from 'wdNetwork/Index'
4 import { LogoutModel } from '../model/LogoutModel' 4 import { LogoutModel } from '../model/LogoutModel'
5 5
@@ -32,5 +32,6 @@ export class LogoutViewModel{ @@ -32,5 +32,6 @@ export class LogoutViewModel{
32 HttpUrlUtils.setUserId("") 32 HttpUrlUtils.setUserId("")
33 HttpUrlUtils.setUserType("") 33 HttpUrlUtils.setUserType("")
34 HttpUrlUtils.setUserToken('') 34 HttpUrlUtils.setUserToken('')
  35 + UserDataLocal.clearUserData()
35 } 36 }
36 } 37 }