Skip to content

Commit

Permalink
eksporterer mutate fra bestilling hook
Browse files Browse the repository at this point in the history
  • Loading branch information
matsbyfl committed Nov 8, 2024
1 parent fb3bc59 commit 80ebcb1
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import { Bestilling } from '../../../types/types.internal'

interface BestillingResponse {
bestilling: Bestilling | undefined
mutate: () => void
}

export function useBestilling(): BestillingResponse {
const { saksnummer: sakId } = useParams<{ saksnummer: string }>()
const { data } = useSwr<{ data: Bestilling }>([`api/bestilling/${sakId}`], httpGet)
const { data, mutate } = useSwr<{ data: Bestilling }>([`api/bestilling/${sakId}`], httpGet)

return {
bestilling: data?.data || undefined,
mutate: mutate,
}
}

0 comments on commit 80ebcb1

Please sign in to comment.