Skip to content

Commit

Permalink
refactor(de and de groups): remove superfluous code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammer5 committed Mar 5, 2024
1 parent 81daead commit e32bbe2
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 224 deletions.
1 change: 0 additions & 1 deletion src/pages/dataElementGroups/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { withTypes } from 'react-final-form'
import { useNavigate, useParams } from 'react-router-dom'
import { Loader } from '../../components'
import {
CustomAttributes,
DefaultFormContents,
useCustomAttributesQuery,
} from '../../components/form'
Expand Down
12 changes: 0 additions & 12 deletions src/pages/dataElementGroups/New.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,8 @@ export function Component() {
const dataEngine = useDataEngine()
const navigate = useNavigate()
const customAttributesQuery = useCustomAttributesQuery()
const loading = customAttributesQuery.loading
const error = customAttributesQuery.error
const initialValues = useInitialValues(customAttributesQuery.data)

if (error && !loading) {
// @TODO(Edit): Implement error screen
return <>Error: {error.toString()}</>
}

if (loading) {
// @TODO(Edit): Implement loading screen
return <>Loading...</>
}

async function onSubmit(payload: FormValues) {
try {
// We want the promise so we know when submitting is done. The promise
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dataElements/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import {
} from '../../components'
import { useCustomAttributesQuery } from '../../components/form'
import { SCHEMA_SECTIONS, getSectionPath, validate } from '../../lib'
import { createJsonPatchOperations } from '../../lib/form/createJsonPatchOperations'
import { getAllAttributeValues } from '../../lib/models/attributes'
import { JsonPatchOperation } from '../../types'
import { Attribute, DataElement } from '../../types/generated'
import { createJsonPatchOperations } from './edit/'
import classes from './Edit.module.css'
import { DataElementFormFields, dataElementSchema } from './form'
import type { FormValues } from './form'
Expand Down
12 changes: 0 additions & 12 deletions src/pages/dataElements/New.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,8 @@ export const Component = () => {
const dataEngine = useDataEngine()
const navigate = useNavigate()
const customAttributesQuery = useCustomAttributesQuery()
const loading = customAttributesQuery.loading
const error = customAttributesQuery.error
const initialValues = useInitialValues(customAttributesQuery.data)

if (error && !loading) {
// @TODO(Edit): Implement error screen
return <>Error: {error.toString()}</>
}

if (loading) {
// @TODO(Edit): Implement loading screen
return <>Loading...</>
}

async function onSubmit(values: FormValues) {
const payload = formatFormValues({ values })

Expand Down
127 changes: 0 additions & 127 deletions src/pages/dataElements/edit/createJsonPatchOperations.spec.ts

This file was deleted.

70 changes: 0 additions & 70 deletions src/pages/dataElements/edit/createJsonPatchOperations.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/pages/dataElements/edit/index.ts

This file was deleted.

0 comments on commit e32bbe2

Please sign in to comment.