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: "",
|
apiBaseUrl: "",
|
||||||
logLevel: "debug",
|
logLevel: "debug",
|
||||||
language: "",
|
language: "",
|
||||||
|
pagespeedApiKey: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAppSettings = createAsyncThunk(
|
export const getAppSettings = createAsyncThunk(
|
||||||
@@ -57,6 +58,7 @@ const handleGetSettingsFulfilled = (state, action) => {
|
|||||||
state.apiBaseUrl = action.payload.data.apiBaseUrl;
|
state.apiBaseUrl = action.payload.data.apiBaseUrl;
|
||||||
state.logLevel = action.payload.data.logLevel;
|
state.logLevel = action.payload.data.logLevel;
|
||||||
state.language = action.payload.data.language;
|
state.language = action.payload.data.language;
|
||||||
|
state.pagespeedApiKey = action.payload.data.pagespeedApiKey;
|
||||||
};
|
};
|
||||||
const handleGetSettingsRejected = (state, action) => {
|
const handleGetSettingsRejected = (state, action) => {
|
||||||
state.isLoading = false;
|
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
|
// If there are any settings that weren't set by environment variables, use user settings from DB
|
||||||
for (const key in envConfig) {
|
for (const key in envConfig) {
|
||||||
|
if (
|
||||||
const envValue = envConfig[key];
|
typeof envConfig?.[key] === "undefined" &&
|
||||||
const dbValue = dbSettings?.[key];
|
typeof dbSettings?.[key] !== "undefined"
|
||||||
|
) {
|
||||||
if (envValue === undefined || envValue === "") {
|
this.settings[key] = dbSettings[key];
|
||||||
if (dbValue !== undefined) {
|
|
||||||
this.settings[key] = dbValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user