Skip to content

Commit

Permalink
clients: Fix saving benefit on modal close
Browse files Browse the repository at this point in the history
  • Loading branch information
birkjernstrom committed Dec 4, 2024
1 parent e5da4fd commit 91fed86
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@polar-sh/sdk'
import Button from 'polarkit/components/ui/atoms/button'
import { Form } from 'polarkit/components/ui/form'
import { useCallback, useState } from 'react'
import { useCallback, useState, MouseEvent } from 'react'
import { useForm } from 'react-hook-form'
import { UpdateBenefitForm } from '../Benefit/BenefitForm'

Expand Down Expand Up @@ -68,6 +68,12 @@ const UpdateBenefitModalContent = ({
[hideModal, updateSubscriptionBenefit, benefit, setError],
)

const onCancel = (e: MouseEvent<HTMLButtonElement>) => {
e.preventDefault()
e.stopPropagation()
hideModal()
}

const { handleSubmit } = form

return (
Expand Down Expand Up @@ -95,7 +101,7 @@ const UpdateBenefitModalContent = ({
<Button
variant="ghost"
className="self-start"
onClick={hideModal}
onClick={onCancel}
>
Cancel
</Button>
Expand Down

0 comments on commit 91fed86

Please sign in to comment.