Merge pull request #2340 from bluewave-labs/hotfix/validation
remove showURL from validation
This commit is contained in:
2 files changed
+9
-8
No files matched your search
@@ -58,6 +58,11 @@ const Settings = () => {
|
||||
const handleChange = async (e) => {
|
||||
const { name, value } = e.target;
|
||||
|
||||
// Special case for showURL until handled properly in the backend
|
||||
if (name === "showURL") {
|
||||
dispatch(setShowURL(value));
|
||||
return;
|
||||
}
|
||||
// Build next state early
|
||||
const newSettingsData = {
|
||||
...settingsData,
|
||||
@@ -86,10 +91,6 @@ const Settings = () => {
|
||||
dispatch(setMode(value));
|
||||
}
|
||||
|
||||
if (name === "showURL") {
|
||||
dispatch(setShowURL(value));
|
||||
}
|
||||
|
||||
if (name === "language") {
|
||||
dispatch(setLanguage(value));
|
||||
i18n.changeLanguage(value);
|
||||
@@ -132,6 +133,7 @@ const Settings = () => {
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
console.log(settingsData.settings);
|
||||
const { error } = settingsValidation.validate(settingsData.settings, {
|
||||
abortEarly: false,
|
||||
});
|
||||
|
||||
@@ -23,7 +23,8 @@ const lastnameSchema = joi
|
||||
.messages({
|
||||
"string.empty": "Surname is required",
|
||||
"string.max": "Surname must be less than 50 characters",
|
||||
"string.pattern.base": "Surname must contain only letters, spaces, apostrophes, or hyphens"
|
||||
"string.pattern.base":
|
||||
"Surname must contain only letters, spaces, apostrophes, or hyphens",
|
||||
});
|
||||
|
||||
const passwordSchema = joi
|
||||
@@ -103,8 +104,7 @@ const credentials = joi.object({
|
||||
});
|
||||
|
||||
const monitorValidation = joi.object({
|
||||
url: joi
|
||||
.when("type", {
|
||||
url: joi.when("type", {
|
||||
is: "docker",
|
||||
then: joi
|
||||
.string()
|
||||
@@ -277,7 +277,6 @@ const settingsValidation = joi.object({
|
||||
}),
|
||||
pagespeedApiKey: joi.string().allow("").optional(),
|
||||
language: joi.string().required(),
|
||||
showURL: joi.bool().required(),
|
||||
systemEmailHost: joi.string().allow(""),
|
||||
systemEmailPort: joi.number().allow(null, ""),
|
||||
systemEmailAddress: joi.string().allow(""),
|
||||
|
||||
Reference in new issue
Block a user