Skip to content

Commit

Permalink
🐛 fix: unable to edit license exam types
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Jun 4, 2023
1 parent 87f3237 commit 2486485
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ export function CADFeaturesTab() {
function createInitialOptions() {
const obj = {} as Partial<Record<Feature, any>>;

const cadFeatures = cad?.features?.options;

for (const key in cadFeatures) {
let option = cadFeatures[key as keyof typeof cadFeatures];
const cadFeatures = cad?.features;
for (const _key in cadFeatures) {
const key = _key as Feature;
let option = cadFeatures.options?.[key];

if (key === Feature.LICENSE_EXAMS) {
if (option.length === 0) {
if (!option || option.length === 0) {
option = Object.values(LicenseExamType);
}
}
Expand Down
12 changes: 6 additions & 6 deletions apps/client/src/hooks/useFeatureEnabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ export function useFeatureEnabled(
const options = React.useMemo(() => {
const obj = {} as Partial<Record<Feature, any>>;

const cadFeatures = _features?.options;
const cadFeatures = _features;
for (const _key in cadFeatures) {
const key = _key as Feature;
let option = cadFeatures.options?.[key];

for (const key in cadFeatures) {
let option = cadFeatures[key as keyof typeof cadFeatures];

if (key === Feature.LICENSE_EXAMS && Array.isArray(option)) {
if (option.length === 0) {
if (key === Feature.LICENSE_EXAMS) {
if (!option || option.length === 0) {
option = Object.values(LicenseExamType);
}
}
Expand Down

0 comments on commit 2486485

Please sign in to comment.