WIP Loading Header & Remaining changes from Sprint 1

This commit is contained in:
Patrick Fic
2020-03-13 19:02:31 -07:00
parent f9fb5e4dc0
commit ca457c76ab
16 changed files with 663 additions and 29 deletions

View File

@@ -0,0 +1,10 @@
import ApplicationActionTypes from "./application.types";
export const startLoading = () => ({
type: ApplicationActionTypes.START_LOADING
});
export const endLoading = options => ({
type: ApplicationActionTypes.END_LOADING,
payload: options
});

View File

@@ -0,0 +1,24 @@
import ApplicationActionTypes from "./application.types";
const INITIAL_STATE = {
loading: false
};
const applicationReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case ApplicationActionTypes.START_LOADING:
return {
...state,
loading: true
};
case ApplicationActionTypes.END_LOADING:
return {
...state,
loading: false
};
default:
return state;
}
};
export default applicationReducer;

View File

@@ -0,0 +1,8 @@
import { createSelector } from "reselect";
const selectApplication = state => state.application;
export const selectLoading = createSelector(
[selectApplication],
application => application.loading
);

View File

@@ -0,0 +1,5 @@
const ApplicationActionTypes = {
START_LOADING: "START_LOADING",
END_LOADING: "END_LOADING"
};
export default ApplicationActionTypes;