请参阅以下有关“JSON.parse( - )”
的问题错误 E:/ Arkin_Angular_Material_latestCode /阿肯布局/ src目录/应用/核心/服务/ http.service.ts(62,53):类型'void |的参数任何[]'都不是 可分配给'string'类型的参数。类型'void'不是 可分配给'string'类型。
实际代码是
refreshToken.then(response => {
if(response != undefined){
const list = JSON.parse(response);
const userSession: UserSession = new UserSession();
userSession.accessToken = list.access_token;
userSession.tokenType = list.token_type;
userSession.refreshToken = list.refresh_token;
userSession.isLoggedin = true;
UserSessionManager.addUserSession(userSession);
console.log(response);
return super.get(fullUrl, this.requestOptions(options))
.catch(this.onCatch)
.do((res: Response) => {
this.onSubscribeSuccess(res);
},(error: any) => {
答案 0 :(得分:0)
试试这个:
userSession.accessToken = list.access_token as String;
userSession.tokenType = list.token_type as String;
userSession.refreshToken = list.refresh_token as String;