Skip to content

Commit

Permalink
Update api client (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
alimpens authored Dec 19, 2024
1 parent 53c8cec commit 88beb56
Show file tree
Hide file tree
Showing 6 changed files with 545 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ exports[`filterFormResponse > renders the correct output 1`] = `
"input": false,
"key": "page1",
"label": "Page 1",
"title": "Page 1",
"type": "panel",
},
{
Expand Down Expand Up @@ -243,6 +244,7 @@ exports[`filterFormResponse > renders the correct output 1`] = `
"input": false,
"key": "page2",
"label": "Page 2",
"title": "Page 2",
"type": "panel",
},
],
Expand Down
4 changes: 2 additions & 2 deletions apps/admin/src/pages/form/utils/filterFormResponse.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { filterFormResponse } from './filterFormResponse'
import { mockData } from './filterFormResponseMock'

// This test compares the output of the function to a snapshot.
// To update the snapshot, run the following command:
// npx nx test admin filterFormResponse.spec.tsx --updateSnapshot
// To update the snapshot, run the following command in apps/admin:
// npx vitest -u
describe('filterFormResponse', () => {
it('renders the correct output', () => {
expect(filterFormResponse(mockData)).toMatchSnapshot()
Expand Down
10 changes: 6 additions & 4 deletions apps/public/src/app/(general)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getStaticForm } from '@meldingen/api-client'
import { getStaticForm, getStaticFormByStaticFormId } from '@meldingen/api-client'

import { Home } from './Home'

Expand All @@ -7,9 +7,11 @@ import { Home } from './Home'
export const dynamic = 'force-dynamic'

export default async () => {
const staticForm = await getStaticForm().then((response) => response.find((form) => form.type === 'primary'))
const primaryFormId = await getStaticForm().then((response) => response.find((form) => form.type === 'primary')?.id)

if (!staticForm) return undefined
if (!primaryFormId) return undefined

return <Home formData={staticForm.components} />
const primaryForm = (await getStaticFormByStaticFormId({ staticFormId: primaryFormId }))?.components

return <Home formData={primaryForm} />
}
Loading

0 comments on commit 88beb56

Please sign in to comment.