From 4928e20eab1c8a25cc680a07407a9aa61d306979 Mon Sep 17 00:00:00 2001 From: Rodrigo Antinarelli Date: Thu, 7 May 2020 11:54:27 -0300 Subject: [PATCH] create AppConfig context --- platform/viewer/src/contexts/AppContextProvider.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/viewer/src/contexts/AppContextProvider.jsx b/platform/viewer/src/contexts/AppContextProvider.jsx index 5c99257c1..340bc88eb 100644 --- a/platform/viewer/src/contexts/AppContextProvider.jsx +++ b/platform/viewer/src/contexts/AppContextProvider.jsx @@ -8,8 +8,12 @@ export const useAppContext = () => useContext(AppContext); const AppContextProvider = ({ children }) => { const [config, setConfig] = useState(null); - const get = ({ configKey }) => { - return config[configKey]; + const get = ({ configKey = null }) => { + if (configKey) { + return config[configKey]; + } + + return config; }; const add = ({ configKey, value }) => {