🪛 WIP on the DCPP search results

This commit is contained in:
2021-08-23 07:36:24 -07:00
parent 0a269b33fb
commit e5870fa1a8
4 changed files with 48 additions and 13 deletions

View File

@@ -2,18 +2,27 @@ import {
AIRDCPP_SEARCH_INSTANCE_CREATED,
AIRDCPP_SEARCH_IN_PROGRESS,
AIRDCPP_SEARCH_RESULTS_RECEIVED,
AIRDCPP_HUB_SEARCHES_SENT,
AIRDCPP_HUB_USER_CONNECTED,
} from "../constants/action-types";
const initialState = {
isAirDCPPSearchInProgress: false,
searchStatus: "",
};
function airdcppReducer(state = initialState, action) {
switch (action.type) {
case AIRDCPP_HUB_USER_CONNECTED:
return {
...state,
searchStatus: "Hub user connected",
}
case AIRDCPP_SEARCH_INSTANCE_CREATED:
return {
...state,
searchInstance: action.searchInstance,
searchStatus: "Search Instance created",
};
case AIRDCPP_SEARCH_IN_PROGRESS:
@@ -28,6 +37,13 @@ function airdcppReducer(state = initialState, action) {
isAirDCPPSearchInProgress: false,
results: action.results,
};
case AIRDCPP_HUB_SEARCHES_SENT:
return {
...state,
searchStatus: "Hub searches sent",
isAirDCPPSearchInProgress: true,
};
default:
return state;
}