1
- import { httpErrorHandler } from '@fpsak-frontend/utils ' ;
1
+ import { kjønn } from '@k9-sak-web/backend/k9sak/kodeverk/Kjønn.js ' ;
2
2
import { FormidlingClientContext } from '@k9-sak-web/gui/app/FormidlingClientContext.js' ;
3
3
import { K9SakClientContext } from '@k9-sak-web/gui/app/K9SakClientContext.js' ;
4
4
import MeldingerBackendClient from '@k9-sak-web/gui/sak/meldinger/MeldingerBackendClient.js' ;
5
- import { apiPaths } from '@k9-sak-web/rest-api' ;
6
- import { useRestApiErrorDispatcher } from '@k9-sak-web/rest-api-hooks' ;
5
+ import NotatBackendClient from '@k9-sak-web/gui/sak/notat/NotatBackendClient.js' ;
7
6
import {
8
7
ArbeidsgiverOpplysningerWrapper ,
9
8
BehandlingAppKontekst ,
10
9
Fagsak ,
11
10
FeatureToggles ,
12
11
NavAnsatt ,
13
- NotatResponse ,
14
12
Personopplysninger ,
15
13
} from '@k9-sak-web/types' ;
16
14
import {
@@ -27,7 +25,6 @@ import {
27
25
} from '@navikt/aksel-icons' ;
28
26
import { BodyShort , Tabs , Tooltip } from '@navikt/ds-react' ;
29
27
import { useQuery } from '@tanstack/react-query' ;
30
- import axios from 'axios' ;
31
28
import { useCallback , useContext , useEffect , useMemo , useRef , useState } from 'react' ;
32
29
import { useNavigate } from 'react-router' ;
33
30
import { getSupportPanelLocationCreator } from '../app/paths' ;
@@ -37,10 +34,9 @@ import styles from './behandlingSupportIndex.module.css';
37
34
import DokumentIndex from './dokument/DokumentIndex' ;
38
35
import HistorikkIndex from './historikk/HistorikkIndex' ;
39
36
import MeldingIndex from './melding/MeldingIndex' ;
40
- import NotaterIndex from './notater/NotaterIndex ' ;
37
+ import Notater from './notater/Notater ' ;
41
38
import SupportTabs from './supportTabs' ;
42
39
import TotrinnskontrollIndex from './totrinnskontroll/TotrinnskontrollIndex' ;
43
- import { kjønn } from '@k9-sak-web/backend/k9sak/kodeverk/Kjønn.js' ;
44
40
45
41
export const hentSynligePaneler = ( behandlingRettigheter ?: BehandlingRettigheter ) : string [ ] =>
46
42
Object . values ( SupportTabs ) . filter ( supportPanel => {
@@ -160,12 +156,12 @@ const BehandlingSupportIndex = ({
160
156
navAnsatt,
161
157
featureToggles,
162
158
} : OwnProps ) => {
163
- const { addErrorMessage } = useRestApiErrorDispatcher ( ) ;
164
159
const [ antallUlesteNotater , setAntallUlesteNotater ] = useState ( 0 ) ;
165
160
166
161
const k9SakClient = useContext ( K9SakClientContext ) ;
167
162
const formidlingClient = useContext ( FormidlingClientContext ) ;
168
163
const meldingerBackendClient = new MeldingerBackendClient ( k9SakClient , formidlingClient ) ;
164
+ const notatBackendClient = new NotatBackendClient ( k9SakClient ) ;
169
165
const [ toTrinnskontrollFormState , setToTrinnskontrollFormState ] = useState ( undefined ) ;
170
166
171
167
const currentResetValue = `${ fagsak . saksnummer } -${ behandlingId } -${ personopplysninger ?. aktoerId } ` ;
@@ -178,23 +174,10 @@ const BehandlingSupportIndex = ({
178
174
prevResetValue . current = currentResetValue ;
179
175
} , [ currentResetValue ] ) ;
180
176
181
- const getNotater = ( signal : AbortSignal ) =>
182
- axios
183
- . get < NotatResponse [ ] > ( apiPaths . notatISak , {
184
- signal,
185
- params : {
186
- saksnummer : fagsak . saksnummer ,
187
- } ,
188
- } )
189
- . then ( ( { data } ) => data )
190
- . catch ( error => {
191
- httpErrorHandler ( error ?. response ?. status , addErrorMessage , error ?. response ?. headers ?. location ) ;
192
- } ) ;
193
-
194
177
const notaterQueryKey = [ 'notater' , fagsak ?. saksnummer ] ;
195
178
const { data : notater } = useQuery ( {
196
179
queryKey : notaterQueryKey ,
197
- queryFn : ( { signal } ) => getNotater ( signal ) ,
180
+ queryFn : ( ) => notatBackendClient . getNotater ( fagsak . saksnummer ) ,
198
181
enabled : ! ! fagsak ,
199
182
refetchOnWindowFocus : false ,
200
183
} ) ;
@@ -337,7 +320,7 @@ const BehandlingSupportIndex = ({
337
320
/>
338
321
</ Tabs . Panel >
339
322
< Tabs . Panel value = { SupportTabs . NOTATER } >
340
- < NotaterIndex navAnsatt = { navAnsatt } fagsak = { fagsak } />
323
+ < Notater navAnsatt = { navAnsatt } fagsak = { fagsak } />
341
324
</ Tabs . Panel >
342
325
</ div >
343
326
</ div >
0 commit comments