Merge pull request #2340 from bluewave-labs/hotfix/validation

remove showURL from validation
This commit is contained in:
Alexander Holliday authored and GitHub committed 2025-05-26 16:37:33 -07:00
commit bfa6197ee4
2 files changed
+9 -8

No files matched your search

+6 -4
View File
@@ -58,6 +58,11 @@ const Settings = () => {
const handleChange = async (e) => { const handleChange = async (e) => {
const { name, value } = e.target; 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 // Build next state early
const newSettingsData = { const newSettingsData = {
...settingsData, ...settingsData,
@@ -86,10 +91,6 @@ const Settings = () => {
dispatch(setMode(value)); dispatch(setMode(value));
} }
if (name === "showURL") {
dispatch(setShowURL(value));
}
if (name === "language") { if (name === "language") {
dispatch(setLanguage(value)); dispatch(setLanguage(value));
i18n.changeLanguage(value); i18n.changeLanguage(value);
@@ -132,6 +133,7 @@ const Settings = () => {
}; };
const handleSave = () => { const handleSave = () => {
console.log(settingsData.settings);
const { error } = settingsValidation.validate(settingsData.settings, { const { error } = settingsValidation.validate(settingsData.settings, {
abortEarly: false, abortEarly: false,
}); });
+3 -4
View File
@@ -23,7 +23,8 @@ const lastnameSchema = joi
.messages({ .messages({
"string.empty": "Surname is required", "string.empty": "Surname is required",
"string.max": "Surname must be less than 50 characters", "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 const passwordSchema = joi
@@ -103,8 +104,7 @@ const credentials = joi.object({
}); });
const monitorValidation = joi.object({ const monitorValidation = joi.object({
url: joi url: joi.when("type", {
.when("type", {
is: "docker", is: "docker",
then: joi then: joi
.string() .string()
@@ -277,7 +277,6 @@ const settingsValidation = joi.object({
}), }),
pagespeedApiKey: joi.string().allow("").optional(), pagespeedApiKey: joi.string().allow("").optional(),
language: joi.string().required(), language: joi.string().required(),
showURL: joi.bool().required(),
systemEmailHost: joi.string().allow(""), systemEmailHost: joi.string().allow(""),
systemEmailPort: joi.number().allow(null, ""), systemEmailPort: joi.number().allow(null, ""),
systemEmailAddress: joi.string().allow(""), systemEmailAddress: joi.string().allow(""),