Skip to content

Commit 4e2c657

Browse files
committed
refactor: remove unnecessary normalizeComponent function
1 parent 652472e commit 4e2c657

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

adminforth/modules/configValidator.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,15 @@ export default class ConfigValidator implements IConfigValidator {
159159
if (!customization.customPages) {
160160
customization.customPages = [];
161161
}
162-
const normalizeComponent = (comp: any) => {
163-
if (typeof comp === 'string') {
164-
return { file: comp, meta: {} };
165-
}
166-
const meta = comp.meta || {};
162+
customization.customPages.forEach((page, i) => {
163+
page.component = this.validateComponent(page.component, errors);
164+
const meta = page.component.meta || {};
167165
if (meta.sidebarAndHeader === undefined) {
168166
meta.sidebarAndHeader = meta.customLayout === true ? 'none' : 'default';
169167
}
170168
delete meta.customLayout;
171-
return { ...comp, meta };
172-
};
173-
174-
customization.customPages.forEach((page, i) => {
175-
const normalizedComponent = normalizeComponent(page.component);
176-
this.validateComponent(normalizedComponent, errors);
177-
customization.customPages[i].component = normalizedComponent;
169+
page.component.meta = meta;
170+
customization.customPages[i].component = page.component;
178171
});
179172

180173
if (!customization.brandName) { //} === undefined) {

0 commit comments

Comments
 (0)