Skip to content

Commit

Permalink
Fikser slik at kall for brev forhåndsvisning fungerer med generert kl…
Browse files Browse the repository at this point in the history
…ient. (#6959)

Generert klientkode var for gammal.
  • Loading branch information
josstn authored Jan 6, 2025
1 parent aa37be8 commit 0fd2f98
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 32 deletions.
2 changes: 1 addition & 1 deletion packages/v2/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"dependencies": {
"@navikt/k9-klage-typescript-client": "1.0.20240513162434-997f3da",
"@navikt/k9-sak-typescript-client": "1.0.20241028110915",
"@navikt/ung-sak-typescript-client": "0.1.20241220134118"
"@navikt/ung-sak-typescript-client": "0.1.20250103103622"
}
}
21 changes: 8 additions & 13 deletions packages/v2/gui/src/prosess/ung-vedtak/UngVedtak.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
behandlingResultatType,
type AksjonspunktDto,
type ForhåndsvisVedtaksbrevResponse,
} from '@k9-sak-web/backend/ungsak/generated';
import { behandlingResultatType, type AksjonspunktDto } from '@k9-sak-web/backend/ungsak/generated';
import { FileSearchIcon } from '@navikt/aksel-icons';
import { BodyShort, Box, Button, Fieldset, HStack, Label, VStack } from '@navikt/ds-react';
import { CheckboxField, Form } from '@navikt/ft-form-hooks';
Expand Down Expand Up @@ -45,14 +41,13 @@ export const UngVedtak = ({ api, behandling, aksjonspunkter, submitCallback, vil

const { refetch, isLoading: forhåndsvisningIsLoading } = useQuery({
queryKey: ['forhandsvisVedtaksbrev', behandling.id],
queryFn: () =>
api.forhåndsvisVedtaksbrev(behandling.id).then((response: ForhåndsvisVedtaksbrevResponse) => {
// Create a URL object from the PDF blob
const fileURL = window.URL.createObjectURL(new Blob([response.data], { type: 'application/pdf' }));

// Open the PDF in a new tab
window.open(fileURL, '_blank');
}),
queryFn: async () => {
const response = await api.forhåndsvisVedtaksbrev(behandling.id);
// Create a URL object from the PDF blob
const fileURL = window.URL.createObjectURL(response);
// Open the PDF in a new tab
window.open(fileURL, '_blank');
},
enabled: false,
});

Expand Down
13 changes: 1 addition & 12 deletions packages/v2/gui/src/prosess/ung-vedtak/UngVedtakBackendClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ForhåndsvisVedtaksbrevResponse, UngSakClient } from '@k9-sak-web/backend/ungsak/generated';
import axios from 'axios';

export default class UngVedtakBackendClient {
#ungsak: UngSakClient;
Expand All @@ -9,16 +8,6 @@ export default class UngVedtakBackendClient {
}

async forhåndsvisVedtaksbrev(behandlingId: number): Promise<ForhåndsvisVedtaksbrevResponse> {
// return this.#ungsak.formidling.forhåndsvisVedtaksbrev({ behandlingId });
return axios.post(
'http://localhost:9005/ung/sak/api/formidling/vedtaksbrev/forhaandsvis',
{ behandlingId },
{
headers: {
Accept: 'application/pdf',
},
responseType: 'blob'
},
);
return this.#ungsak.formidling.forhåndsvisVedtaksbrev({ behandlingId });
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { ForhåndsvisVedtaksbrevResponse } from '@k9-sak-web/backend/ungsak/generated';
import { fakePdf } from './fakePdf.js';

export class FakeUngVedtakBackendApi {
async forhåndsvisVedtaksbrev(): Promise<ForhåndsvisVedtaksbrevResponse> {
return;
return fakePdf();
}
}
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3935,7 +3935,7 @@ __metadata:
dependencies:
"@navikt/k9-klage-typescript-client": 1.0.20240513162434-997f3da
"@navikt/k9-sak-typescript-client": 1.0.20241028110915
"@navikt/ung-sak-typescript-client": 0.1.20241220134118
"@navikt/ung-sak-typescript-client": 0.1.20250103103622
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -5451,10 +5451,10 @@ __metadata:
languageName: node
linkType: hard

"@navikt/ung-sak-typescript-client@npm:0.1.20241220134118":
version: 0.1.20241220134118
resolution: "@navikt/ung-sak-typescript-client@npm:0.1.20241220134118::__archiveUrl=https%3A%2F%2Fnpm.pkg.github.com%2Fdownload%2F%40navikt%2Fung-sak-typescript-client%2F0.1.20241220134118%2F783667e56032d75cc5f1d69a86664a7e50e60d15"
checksum: 15bf6686d6b30485e90dbd113184bc75383e2e721cd772169cf9cd9e0b181d9d0a040a865bba5e321c10877d813de1ac0804c814a6efdf58663576b88c9fe1d6
"@navikt/ung-sak-typescript-client@npm:0.1.20250103103622":
version: 0.1.20250103103622
resolution: "@navikt/ung-sak-typescript-client@npm:0.1.20250103103622::__archiveUrl=https%3A%2F%2Fnpm.pkg.github.com%2Fdownload%2F%40navikt%2Fung-sak-typescript-client%2F0.1.20250103103622%2F553036253ddfd19e6e781ebf1da4a736dd747039"
checksum: 1e1552188bd2e9f19e355e29e97f1ee6100dc7f6eb20e474ac49b38e6c57bdbe78f7041fd9c936351fc4c9f58e3f6321c2fff8f93225146ebacbdaa8a6ffbf8a
languageName: node
linkType: hard

Expand Down

0 comments on commit 0fd2f98

Please sign in to comment.