add pagespeed to intialstate and handler in settingsslice
This commit is contained in:
1 parent
b493b5e0e5
commit
85c3a16f41
2 files changed
+7
-8
No files matched your search
@@ -6,6 +6,7 @@ const initialState = {
|
||||
apiBaseUrl: "",
|
||||
logLevel: "debug",
|
||||
language: "",
|
||||
pagespeedApiKey: "",
|
||||
};
|
||||
|
||||
export const getAppSettings = createAsyncThunk(
|
||||
@@ -57,6 +58,7 @@ const handleGetSettingsFulfilled = (state, action) => {
|
||||
state.apiBaseUrl = action.payload.data.apiBaseUrl;
|
||||
state.logLevel = action.payload.data.logLevel;
|
||||
state.language = action.payload.data.language;
|
||||
state.pagespeedApiKey = action.payload.data.pagespeedApiKey;
|
||||
};
|
||||
const handleGetSettingsRejected = (state, action) => {
|
||||
state.isLoading = false;
|
||||
|
||||
@@ -48,14 +48,11 @@ class SettingsService {
|
||||
|
||||
// If there are any settings that weren't set by environment variables, use user settings from DB
|
||||
for (const key in envConfig) {
|
||||
|
||||
const envValue = envConfig[key];
|
||||
const dbValue = dbSettings?.[key];
|
||||
|
||||
if (envValue === undefined || envValue === "") {
|
||||
if (dbValue !== undefined) {
|
||||
this.settings[key] = dbValue;
|
||||
}
|
||||
if (
|
||||
typeof envConfig?.[key] === "undefined" &&
|
||||
typeof dbSettings?.[key] !== "undefined"
|
||||
) {
|
||||
this.settings[key] = dbSettings[key];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user