refactoring of chat search
This commit is contained in:
parent
de0a6b016e
commit
6657461150
|
@ -1772,10 +1772,13 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
// CASE :: searching text after retrieve All event Infos.
|
// CASE :: searching text after retrieve All event Infos.
|
||||||
this.store.dispatch(
|
this.store.dispatch(
|
||||||
EventStore.infoAll({
|
EventStore.infoAll({
|
||||||
|
req: {
|
||||||
roomSeq: this.roomInfoSubject.value.roomSeq,
|
roomSeq: this.roomInfoSubject.value.roomSeq,
|
||||||
baseSeq: this.eventListSubject.value[0].seq,
|
baseSeq: this.eventListSubject.value[0].seq,
|
||||||
requestCount:
|
requestCount:
|
||||||
environment.productConfig.CommonSetting.eventRequestDefaultCount * 2
|
environment.productConfig.CommonSetting.eventRequestDefaultCount * 2
|
||||||
|
},
|
||||||
|
infoList: undefined
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ export const infoForSearchEnd = createAction(
|
||||||
|
|
||||||
export const infoAll = createAction(
|
export const infoAll = createAction(
|
||||||
'[Messenger::Event] Info All',
|
'[Messenger::Event] Info All',
|
||||||
props<InfoRequest>()
|
props<{ req: InfoRequest; infoList: Info<EventJson>[] }>()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const fileInfo = createAction(
|
export const fileInfo = createAction(
|
||||||
|
|
|
@ -412,7 +412,10 @@ export class Effects {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
switchMap(([req, processing]) => {
|
switchMap(([params, processing]) => {
|
||||||
|
const req = params.req;
|
||||||
|
const mergedInfoList = params.infoList;
|
||||||
|
|
||||||
return this.eventProtocolService.info(req).pipe(
|
return this.eventProtocolService.info(req).pipe(
|
||||||
map(async res => {
|
map(async res => {
|
||||||
switch (res.SSVC_TYPE) {
|
switch (res.SSVC_TYPE) {
|
||||||
|
@ -421,31 +424,36 @@ export class Effects {
|
||||||
break;
|
break;
|
||||||
case SSVC_TYPE_EVENT_INFO_RES:
|
case SSVC_TYPE_EVENT_INFO_RES:
|
||||||
{
|
{
|
||||||
|
if (
|
||||||
|
infoList.length > 0 &&
|
||||||
|
infoList.length >= req.requestCount &&
|
||||||
|
processing
|
||||||
|
) {
|
||||||
|
// 재귀
|
||||||
|
this.store.dispatch(
|
||||||
|
infoAll({
|
||||||
|
req: {
|
||||||
|
roomSeq: req.roomSeq,
|
||||||
|
baseSeq: infoList[0].seq,
|
||||||
|
requestCount: req.requestCount
|
||||||
|
},
|
||||||
|
infoList: !!mergedInfoList
|
||||||
|
? [...infoList, ...mergedInfoList]
|
||||||
|
: infoList
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
this.store.dispatch(
|
this.store.dispatch(
|
||||||
infoMoreSuccess({
|
infoMoreSuccess({
|
||||||
infoList,
|
infoList: !!mergedInfoList
|
||||||
|
? [...infoList, ...mergedInfoList]
|
||||||
|
: infoList,
|
||||||
res: res as InfoResponse,
|
res: res as InfoResponse,
|
||||||
remainInfo:
|
remainInfo:
|
||||||
infoList.length === req.requestCount ? true : false
|
infoList.length === req.requestCount ? true : false
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
if (infoList.length > 0) {
|
|
||||||
if (infoList.length === req.requestCount && processing) {
|
|
||||||
// 재귀
|
|
||||||
this.store.dispatch(
|
|
||||||
infoAll({
|
|
||||||
roomSeq: req.roomSeq,
|
|
||||||
baseSeq: infoList[0].seq,
|
|
||||||
requestCount: req.requestCount
|
|
||||||
})
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
if (infoList.length < req.requestCount) {
|
|
||||||
this.store.dispatch(infoForSearchEnd({}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.store.dispatch(infoForSearchEnd({}));
|
this.store.dispatch(infoForSearchEnd({}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user