handle error and loading state

This commit is contained in:
Maren Süwer
2018-08-09 12:09:50 +02:00
parent 4f8101a8dd
commit 866a70b816
5 changed files with 107 additions and 9 deletions

View File

@@ -2,6 +2,8 @@
import { apiClient } from "../../apiclient";
import * as types from "../../modules/types";
import type { Action } from "../../types/Action";
import { isPending } from "../../modules/pending";
import { getFailure } from "../../modules/failure";
export const FETCH_CONFIG = "scm/groups/FETCH_CONFIG";
export const FETCH_CONFIG_PENDING = `${FETCH_CONFIG}_${types.PENDING_SUFFIX}`;
@@ -69,3 +71,13 @@ function reducer(state: any = {}, action: any = {}) {
}
export default reducer;
// selectors
export function isFetchConfigPending(state: Object) {
return isPending(state, FETCH_CONFIG);
}
export function getFetchConfigFailure(state: Object) {
return getFailure(state, FETCH_CONFIG);
}