is_empty flag

This commit is contained in:
muerwre 2019-02-18 15:44:06 +07:00
parent a180e00ffb
commit 9b6ed74300
8 changed files with 43 additions and 19 deletions

View file

@ -63,3 +63,4 @@ export const searchPutRoutes = payload => ({ type: ACTIONS.SEARCH_PUT_ROUTES, ..
export const setMarkersShown = markers_shown => ({ type: ACTIONS.SET_MARKERS_SHOWN, markers_shown });
export const getGPXTrack = () => ({ type: ACTIONS.GET_GPX_TRACK });
export const setIsEmpty = is_empty => ({ type: ACTIONS.SET_IS_EMPTY, is_empty });

View file

@ -70,4 +70,5 @@ export const ACTIONS: IActions = {
SET_MARKERS_SHOWN: 'SET_MARKERS_SHOWN',
GET_GPX_TRACK: 'GET_GPX_TRACK',
SET_IS_EMPTY: 'SET_IS_EMPTY',
};

View file

@ -1,4 +1,3 @@
// @flow
import { createReducer } from 'reduxsauce';
import { ACTIONS } from '$redux/user/constants';
import { DEFAULT_USER, IUser } from '$constants/auth';
@ -34,6 +33,7 @@ interface IRootReducer {
provider: keyof typeof PROVIDERS,
is_public: boolean,
markers_shown: boolean,
is_empty: boolean,
save_error: string,
save_finished: boolean,
@ -269,6 +269,7 @@ const setSpeed: ActionHandler<typeof ActionCreators.setSpeed> = (state, { speed
});
const setMarkersShown: ActionHandler<typeof ActionCreators.setMarkersShown> = (state, { markers_shown = true }) => ({ ...state, markers_shown });
const setIsEmpty: ActionHandler<typeof ActionCreators.setIsEmpty> = (state, { is_empty = true }) => ({ ...state, is_empty });
const HANDLERS = ({
[ACTIONS.SET_USER]: setUser,
@ -308,6 +309,7 @@ const HANDLERS = ({
[ACTIONS.SET_SPEED]: setSpeed,
[ACTIONS.SET_MARKERS_SHOWN]: setMarkersShown,
[ACTIONS.SET_IS_EMPTY]: setIsEmpty,
});
export const INITIAL_STATE: IRootReducer = {
@ -328,6 +330,7 @@ export const INITIAL_STATE: IRootReducer = {
provider: DEFAULT_PROVIDER,
is_public: false,
markers_shown: true,
is_empty: true,
save_error: '',
save_finished: false,