Slett feilmeldinger (#34)
* ✨ Backend støtter mulighet for å slette innmeldte feilmeldinger * ✨ Knapp i redigeringsverktøy for sletting av feil * 🐛 Fikset routing bug, Delete was not allowed, og feil endepunkt i frontend * ♿️ Refresher mainpage ved sletting av feil --------- Co-authored-by: Amalie Mansåker <amalie.erdal.mansaker@nav.no> Co-authored-by: Sindre Kjelsrud <sindre.kjelsrud@nav.no>
This commit is contained in:
parent
df3ce139c2
commit
900422a4e0
4 changed files with 46 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
import { FloppydiskIcon, XMarkIcon } from "@navikt/aksel-icons"
|
||||
import { FloppydiskIcon, TrashIcon, XMarkIcon } from "@navikt/aksel-icons"
|
||||
import { TextField, Textarea, RadioGroup, Radio, Button, Switch, Heading } from "@navikt/ds-react"
|
||||
import { useState } from "react"
|
||||
import { FeilmeldingsInnholdInterface } from "../interface"
|
||||
|
@ -102,8 +102,34 @@ const RedigeringsVerktoy = (props: redigeringsInterface) => {
|
|||
>
|
||||
Avbryt
|
||||
</Button>
|
||||
<SlettFeilKnapp setVisModal={props.setVisModal} reset={props.reset} id={props.id}/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default RedigeringsVerktoy;
|
||||
|
||||
|
||||
|
||||
|
||||
const SlettFeilKnapp = (props: {
|
||||
id : number
|
||||
reset: () => void
|
||||
setVisModal: (visModal: boolean) => void
|
||||
}) => {
|
||||
const SlettFeil = async () => {
|
||||
await axios.delete(`/api/slettfeilmelding/${props.id}`)
|
||||
props.reset()
|
||||
props.setVisModal(false)
|
||||
}
|
||||
|
||||
return(
|
||||
<Button
|
||||
variant="danger"
|
||||
icon={<TrashIcon/>}
|
||||
onClick={SlettFeil}
|
||||
>
|
||||
Slett feil
|
||||
</Button>
|
||||
)
|
||||
}
|
Reference in a new issue