From 54737356b791739e8a1a50f7691537a80a9249fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kim=20Andre=20N=C3=A6ss?=
Date: Fri, 25 Oct 2024 12:27:47 +0200
Subject: [PATCH] =?UTF-8?q?Opph=C3=B8r=20fors=C3=B8rgertilegg=20knapp?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 22 +++++++++++++++++
app/routes/batch-opprett._index.tsx | 6 +++++
.../batch-opprett.opphoerforsorgertilegg.tsx | 12 ++++++++++
.../batch.opphoerforsorgertilegg.server.ts | 24 +++++++++++++++++++
4 files changed, 64 insertions(+)
create mode 100644 .idea/workspace.xml
create mode 100644 app/routes/batch-opprett.opphoerforsorgertilegg.tsx
create mode 100644 app/services/batch.opphoerforsorgertilegg.server.ts
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..30f8f6d
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/routes/batch-opprett._index.tsx b/app/routes/batch-opprett._index.tsx
index c2d8953..9effe9c 100644
--- a/app/routes/batch-opprett._index.tsx
+++ b/app/routes/batch-opprett._index.tsx
@@ -127,6 +127,12 @@ export default function BatchOpprett_index() {
+ Opprett Opphør av Forsørgertilegg
+
Opprett RTV Brev Sammenligninger
diff --git a/app/routes/batch-opprett.opphoerforsorgertilegg.tsx b/app/routes/batch-opprett.opphoerforsorgertilegg.tsx
new file mode 100644
index 0000000..95f23ab
--- /dev/null
+++ b/app/routes/batch-opprett.opphoerforsorgertilegg.tsx
@@ -0,0 +1,12 @@
+import { ActionFunctionArgs, redirect } from '@remix-run/node'
+import { requireAccessToken } from '~/services/auth.server'
+import { opphoerforsorgertilegg } from '~/services/batch.opphoerforsorgertilegg.server'
+
+export const action = async ({ request }: ActionFunctionArgs) => {
+ const accessToken = await requireAccessToken(request)
+
+ let response = await opphoerforsorgertilegg(accessToken)
+
+ return redirect(`/behandling/${response.behandlingId}`)
+}
+
diff --git a/app/services/batch.opphoerforsorgertilegg.server.ts b/app/services/batch.opphoerforsorgertilegg.server.ts
new file mode 100644
index 0000000..e7e85b1
--- /dev/null
+++ b/app/services/batch.opphoerforsorgertilegg.server.ts
@@ -0,0 +1,24 @@
+import { env } from '~/services/env.server'
+import { StartBatchResponse } from '~/types'
+
+export async function opphoerforsorgertilegg(
+ accessToken: string,
+): Promise {
+ const response = await fetch(
+ `${env.penUrl}/springapi/opphoerforsorgertilegg`,
+ {
+ method: 'POST',
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ 'Content-Type': 'application/json',
+ 'X-Request-ID': crypto.randomUUID(),
+ },
+ },
+ )
+ if (response.ok) {
+ return (await response.json()) as StartBatchResponse
+ } else {
+ throw new Error()
+ }
+}
+