Created
June 18, 2023 04:42
-
-
Save Aldikitta/7e38ade047c4e1be55a6f50ce22a8233 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val getListAgent: StateFlow<ListAgentVisit> = flow { | |
val agentList = useCase.getListAgentVisitWithFullResponse( | |
body = GetAgentVisitRequest( | |
branchCode = useCase.getAccountInfo().branchCode, | |
moId = useCase.getAccountInfo().employeeId, | |
skip = 1, | |
search = "", | |
prospectConsument = "", | |
agentProfessionCode = "", | |
startDate = "", | |
endDate = "" | |
) | |
).cachedIn(viewModelScope) | |
emit(ListAgentVisit(agentList = agentList)) | |
}.stateIn( | |
viewModelScope, | |
SharingStarted.WhileSubscribed(5_000), | |
ListAgentVisit.default | |
) | |
data class ListAgentVisit( | |
val agentList: Flow<PagingData<GetAgentVisitResponse>>, | |
) { | |
companion object { | |
val default: ListAgentVisit = ListAgentVisit( | |
agentList = emptyFlow(), | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment