bugfix :: login 시 필드에 '+' 문자가 빈문자로 치환되는 문제 수정.

This commit is contained in:
leejinho 2020-03-20 18:15:21 +09:00
parent 57e55036e8
commit 5ba16d1ac0
3 changed files with 36 additions and 2 deletions

View File

@ -0,0 +1,20 @@
import { HttpParameterCodec } from '@angular/common/http';
export class HttpUrlEncodingCodec implements HttpParameterCodec {
encodeKey(k: string): string {
return this.standardEncoding(k);
}
encodeValue(v: string): string {
return this.standardEncoding(v);
}
decodeKey(k: string): string {
return decodeURIComponent(k);
}
decodeValue(v: string) {
return decodeURIComponent(v);
}
standardEncoding(v: string): string {
return encodeURIComponent(v);
}
}

View File

@ -3,6 +3,7 @@
*/
export * from './lib/apis/api';
export * from './lib/apis/httpUrlEncodingCodec';
export * from './lib/types/message-status-code.type';
export * from './lib/types/status-code.type';

View File

@ -1,6 +1,12 @@
import { ParameterUtil, APIEncoder, APIDecoder } from '@ucap-webmessenger/api';
import {
ParameterUtil,
APIEncoder,
APIDecoder,
HttpUrlEncodingCodec
} from '@ucap-webmessenger/api';
import { PIRequest, PIResponse } from './pi';
import { HttpParams, HttpParameterCodec } from '@angular/common/http';
export interface Login2Request extends PIRequest {
companyCode: string;
@ -26,7 +32,14 @@ const login2EncodeMap = {
};
export const encodeLogin2: APIEncoder<Login2Request> = (req: Login2Request) => {
return ParameterUtil.encode(login2EncodeMap, req);
let parameter: HttpParams = new HttpParams({
encoder: new HttpUrlEncodingCodec()
});
parameter = parameter.append('companyCd', req.companyCode);
parameter = parameter.append('loginId', req.loginId);
parameter = parameter.append('loginPw', req.loginPw);
return parameter;
// return ParameterUtil.encodeForm(login2EncodeMap, req);
};
export const decodeLogin2: APIDecoder<Login2Response> = (res: any) => {