mirror of
https://github.com/bendtherules/github-delete-unused-repos.git
synced 2026-08-18 13:52:59 +00:00
Reformat reducers.ts
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
import { Reducer, createStore, Store } from 'redux';
|
||||
import { devToolsEnhancer } from 'redux-devtools-extension';
|
||||
|
||||
import { ApplicationState, FilterStatus, RepoFilterState, FilterSteps } from './model';
|
||||
import {
|
||||
ApplicationState,
|
||||
FilterStatus,
|
||||
RepoFilterState,
|
||||
FilterSteps,
|
||||
} from './model';
|
||||
import {
|
||||
ActionNames,
|
||||
InitUserNameArgs,
|
||||
@@ -10,13 +15,11 @@ import {
|
||||
ActionsType,
|
||||
} from './actions';
|
||||
|
||||
|
||||
function calculateAggregateStatus(repoFilterState: RepoFilterState) {
|
||||
let aggregatedStatus = FilterStatus.pass;
|
||||
|
||||
const filterStepValues = Object.values(FilterSteps) as FilterSteps[];
|
||||
|
||||
|
||||
for (const stepName of filterStepValues) {
|
||||
const stepStatus = repoFilterState[stepName].status;
|
||||
if (stepStatus === FilterStatus.fail) {
|
||||
@@ -85,8 +88,9 @@ export const reducer: Reducer<ApplicationState, ActionsType> = (
|
||||
clonedRepoState.filterState[action.payload.filterStep] =
|
||||
action.payload.filterState;
|
||||
|
||||
clonedRepoState.filterState[FilterSteps.aggregated].status =
|
||||
calculateAggregateStatus(clonedRepoState.filterState);
|
||||
clonedRepoState.filterState[
|
||||
FilterSteps.aggregated
|
||||
].status = calculateAggregateStatus(clonedRepoState.filterState);
|
||||
|
||||
clonedAppState.set(action.payload.repoName, clonedRepoState);
|
||||
return { ...state, repoStateMap: clonedAppState };
|
||||
|
||||
Reference in New Issue
Block a user