Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
matsbyfl committed Dec 2, 2024
2 parents e7050ed + 18510a4 commit c067e9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 2 additions & 6 deletions client/src/oppgaveliste/dokumenter/useDokumentliste.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useSwr from 'swr'
import { httpGet } from '../../io/http'
import { OppgaverResponse, Oppgavetype } from '../../types/types.internal'
import { OppgaverResponse, Oppgavetype, Statuskategori } from '../../types/types.internal'

const oppgaverBasePath = 'api/oppgaver-v2'

Expand All @@ -12,12 +12,8 @@ interface OppgaverData {
}

export function useDokumentliste(): OppgaverData {
const relevanteStatuser = ['OPPRETTET', 'ÅPNET', 'UNDER_BEHANDLING']
.map((status) => `oppgavestatus=${encodeURIComponent(status)}`)
.join('&')

const { data, error, mutate, isLoading } = useSwr<{ data: OppgaverResponse }>(
`${oppgaverBasePath}?oppgavetype=${encodeURIComponent(Oppgavetype.JOURNALFØRING)}&${relevanteStatuser}`,
`${oppgaverBasePath}?oppgavetype=${encodeURIComponent(Oppgavetype.JOURNALFØRING)}&statuskategori=${encodeURIComponent(Statuskategori.ÅPEN)}`,
httpGet,
{
refreshInterval: 10_000,
Expand Down
5 changes: 5 additions & 0 deletions client/src/types/types.internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,11 @@ export enum Oppgavestatus {
FEILREGISTRERT = 'FEILREGISTRERT',
}

export enum Statuskategori {
ÅPEN = 'ÅPEN',
AVSLUTTET = 'AVSLUTTET',
}

export const OppgavestatusLabel = new Map<string, string>([
[Oppgavestatus.OPPRETTET, 'Mottatt'],
[Oppgavestatus.ÅPNET, 'Mottatt'],
Expand Down

0 comments on commit c067e9b

Please sign in to comment.