Skip to content

Commit

Permalink
fix(edit): fix wrong id
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindgrutle committed Jun 26, 2024
1 parent 896d6ff commit 095bc98
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use client'
import { useToast } from '@entur/alert'
import { Button } from '@entur/button'
import { AddIcon } from '@entur/icons'
import { OverflowMenuItem } from '@entur/menu'
Expand All @@ -14,23 +15,27 @@ function DuplicateBoard({
oid?: TOrganizationID
type?: 'button' | 'action'
}) {
const { addToast } = useToast()
const handleSelect = async () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { id, ...boardWithoutId } = board
await create(
{
...board,
...boardWithoutId,
meta: {
...board.meta,
title: board.meta.title + ' - duplikat',
...boardWithoutId.meta,
title: boardWithoutId.meta.title + ' - duplikat',
},
},
oid,
)
addToast('Tavle duplisert!')
}
if (type === 'button')
return (
<Button
variant="secondary"
aria-label="Slett tavle"
aria-label="Dupliser tavle"
onClick={handleSelect}
>
Dupliser Tavle
Expand Down

0 comments on commit 095bc98

Please sign in to comment.