optionally use settings from admin app

This commit is contained in:
Sharon Kennedy
2020-10-20 19:29:12 -04:00
parent de4106c093
commit 9432e4d86f
6 changed files with 44 additions and 65 deletions

View File

@@ -10,7 +10,12 @@ const ChatboxWithSettings = ({ settingsEndpoint, ...rest }) => {
const getSettings = async () => {
if (!settingsEndpoint) {
return null;
const props = {
...rest,
enabled: true
}
return setSettings(props);
}
const res = await fetch(settingsEndpoint);
@@ -25,7 +30,9 @@ const ChatboxWithSettings = ({ settingsEndpoint, ...rest }) => {
}
});
console.log("settings", settingsObj)
if (!settingsObj.enabled) {
settingsObj.enabled = false;
}
return setSettings(settingsObj);
};