Skip to content

Commit

Permalink
refactor(edithomepaeg): remove extra prop
Browse files Browse the repository at this point in the history
  • Loading branch information
seaerchin committed Aug 29, 2023
1 parent 5b6fa9c commit d868e2b
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/layouts/EditHomepage/EditHomepage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,19 @@ const getHasError = (errorArray) =>
// Section constructors
// TODO: Export all these as const and write wrapper for error...

const enumSection = (type, isError) => {
const enumSection = (type) => {
switch (type) {
case "resources":
return isError
? { resources: getDefaultValues(RESOURCES_SECTION) }
: { resources: RESOURCES_SECTION }
return { resources: getDefaultValues(RESOURCES_SECTION) }

case "infobar":
return isError
? { infobar: getDefaultValues(INFOBAR_SECTION) }
: { infobar: INFOBAR_SECTION }
return { infobar: getDefaultValues(INFOBAR_SECTION) }

case "infopic":
return isError
? { infopic: getDefaultValues(INFOPIC_SECTION) }
: { infopic: INFOPIC_SECTION }
return { infopic: getDefaultValues(INFOPIC_SECTION) }

default:
return isError
? { infobar: getDefaultValues(INFOBAR_SECTION) }
: { infobar: INFOBAR_SECTION }
return { infobar: getDefaultValues(INFOBAR_SECTION) }
}
}

Expand Down Expand Up @@ -502,9 +494,8 @@ const EditHomepage = ({ match }) => {

switch (elemType) {
case "section": {
// NOTE: setting `isError` to true to get an empty object
const val = enumSection(value, true)
const err = enumSection(value, true)
const val = enumSection(value)
const err = enumSection(value)

const newScrollRefs = update(scrollRefs, { $push: [createRef()] })

Expand Down

0 comments on commit d868e2b

Please sign in to comment.