Skip to content

Commit

Permalink
fix: allow buttons in edit and preview mode to reload when clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
kathleenkhy committed Feb 20, 2024
1 parent 36b89ae commit ef3e717
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export const PaymentEndPageBlock = ({
return 'You have successfully submitted your response.'
}, [form?.title])

const handleButtonClick = () => {
window.location.reload()
}

if (!isPaymentEnabled) {
return <></>
}
Expand All @@ -68,6 +72,7 @@ export const PaymentEndPageBlock = ({
products={paymentProducts}
name={'Product/ Service'}
paymentDate={new Date()}
onClick={handleButtonClick}
/>
</Box>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useRef } from 'react'
import { Box, Container, Text, VisuallyHidden } from '@chakra-ui/react'
import { Box, Text, VisuallyHidden } from '@chakra-ui/react'
import { format } from 'date-fns'

import { FormColorTheme, FormDto } from '~shared/types/form'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type DownloadReceiptBlockProps = {
name: string
paymentDate: Date | null
endPage: FormDto['endPage']
onClick?: () => void
}

const PaymentDetailsRow = ({
Expand Down Expand Up @@ -111,6 +112,7 @@ export const DownloadReceiptBlock = ({
products,
paymentDate,
endPage,
onClick,
}: DownloadReceiptBlockProps) => {
const toast = useToast({ status: 'success', isClosable: true })

Expand Down Expand Up @@ -194,7 +196,7 @@ export const DownloadReceiptBlock = ({
<Button
w="100%"
leftIcon={<BiDownload fontSize="1.5rem" />}
onClick={handleInvoiceClick}
onClick={onClick || handleInvoiceClick}
>
Save proof of payment
</Button>
Expand Down

0 comments on commit ef3e717

Please sign in to comment.