@@ -3,18 +3,18 @@ import React from 'react';
33import { useBooleanState } from '../../hooks/useBooleanState' ;
44import { commonText } from '../../localization/common' ;
55import { userText } from '../../localization/user' ;
6+ import { ajax } from '../../utils/ajax' ;
67import { type RA , localized } from '../../utils/types' ;
78import { Container , H2 , H3 , Ul } from '../Atoms' ;
89import { Button } from '../Atoms/Button' ;
910import type { SpecifyResource } from '../DataModel/legacyTypes' ;
11+ import { serializeResource } from '../DataModel/serializers' ;
1012import { tables } from '../DataModel/tables' ;
1113import type { Collection , Discipline , Division } from '../DataModel/types' ;
1214import { collection } from '../FormParse/webOnlyViews' ;
1315import { ResourceView } from '../Forms/ResourceView' ;
1416import { load } from '../InitialContext' ;
1517import { Dialog , LoadingScreen } from '../Molecules/Dialog' ;
16- import { ajax } from '../../utils/ajax' ;
17- import { serializeResource } from '../DataModel/serializers' ;
1818
1919export function SystemConfigurationTool ( ) : JSX . Element | null {
2020 const [ allInfo , setAllInfo ] = React . useState < InstitutionData | null > ( null ) ;
@@ -23,10 +23,7 @@ export function SystemConfigurationTool(): JSX.Element | null {
2323 useBooleanState ( ) ;
2424
2525 const [ newResource , setNewResource ] = React . useState <
26- | SpecifyResource < Collection >
27- | SpecifyResource < Division >
28- | SpecifyResource < Discipline >
29- | undefined
26+ SpecifyResource < Collection > | SpecifyResource < Discipline > | SpecifyResource < Division > | undefined
3027 > ( ) ;
3128
3229 React . useEffect ( ( ) => {
@@ -56,7 +53,7 @@ export function SystemConfigurationTool(): JSX.Element | null {
5653 } ,
5754 body : data ,
5855 } )
59- . then ( ( ) => fetchAllSystemData )
56+ . then ( async ( ) => fetchAllSystemData )
6057 . then ( setAllInfo )
6158 . then ( ( ) => closeNewResource ( ) ) ;
6259 } ;
@@ -79,7 +76,7 @@ export function SystemConfigurationTool(): JSX.Element | null {
7976 `'Add new division to institution' ${ institution . id } `
8077 ) ;
8178 setNewResource (
82- new tables . Division . Resource ( ) as SpecifyResource < Collection >
79+ new tables . Division . Resource ( )
8380 ) ;
8481 handleNewResource ( ) ;
8582 } }
@@ -100,7 +97,7 @@ export function SystemConfigurationTool(): JSX.Element | null {
10097 setNewResource (
10198 new tables . Discipline . Resource ( {
10299 division : `/api/specify/discipline/${ division . id } /` ,
103- } ) as SpecifyResource < Discipline >
100+ } )
104101 ) ;
105102 handleNewResource ( ) ;
106103 } }
@@ -122,7 +119,7 @@ export function SystemConfigurationTool(): JSX.Element | null {
122119 setNewResource (
123120 new tables . Collection . Resource ( {
124121 discipline : `/api/specify/discipline/${ discipline . id } /` ,
125- } ) as SpecifyResource < Collection >
122+ } )
126123 ) ;
127124 handleNewResource ( ) ;
128125 } }
0 commit comments