export const initialState = {
  loading: false,
  loaded: false,
  data: []
};

const setLoading = (loading, state) => ({ ...state, loading });
const setLoaded = (loaded, state) => ({ ...state, loaded });

export default {
  getRegionsInit: state => setLoading(true, state),
  getRegionsReady: (state, { payload }) =>
    setLoaded(true, setLoading(false, { ...state, data: payload }))
};

@@ -97,22 +97,22 @@
  = (
+state, 
 loading
-, state
 ) =%3E
@@ -160,21 +160,21 @@
  = (
-loaded, state
+state, loaded
 ) =%3E
@@ -258,18 +258,18 @@
 ing(
-true, stat
+state, tru
 e),%0A
@@ -329,14 +329,8 @@
 ded(
-true, 
 setL
@@ -340,15 +340,8 @@
 ing(
-false, 
 %7B ..
@@ -363,14 +363,27 @@
 ayload %7D
-)
+, false), true
 )%0A%7D;%0A

swap state direction for cleaner function