Commit 52bfb0bd authored by SHAWNA MONERO's avatar SHAWNA MONERO
Browse files

hydrateAll

No related merge requests found
Showing with 10 additions and 0 deletions
+10 -0
......@@ -82,12 +82,21 @@ const hydrate = (key: string): Thunk<ManagerLayout, Action> => {
};
};
const hydrateAll = () => {
return getState => {
const state = getState();
Object.keys(state).forEach(key => {
hydrate(key);
});
};
};
export interface DataManager {
state: object;
assign: (key: string, value: object) => void;
hydrate: (key: string) => void;
update: (key: string, value: object) => void;
reset: () => void;
hydrateAll: () => void;
}
const defaultTransform = (data: object): object => data;
......@@ -124,6 +133,7 @@ const useDataLayoutManager = (layouts: ManagerLayout): DataManager => {
hydrate: key => dispatch(hydrate(key)),
update: (key, value) => dispatch(update(key, value)),
reset: () => dispatch(reset()),
hydrateAll: () => dispatch(hydrateAll()),
};
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment