fix: not owner can not pay (#1772)

This commit is contained in:
Joel
2023-12-18 16:54:47 +08:00
committed by GitHub
parent ebc2cdad2e
commit 354d033e60
7 changed files with 24 additions and 8 deletions

View File

@@ -11,23 +11,23 @@ import { useProviderContext } from '@/context/provider-context'
const Billing: FC = () => {
const { t } = useTranslation()
const { isCurrentWorkspaceManager } = useAppContext()
const { isCurrentWorkspaceOwner } = useAppContext()
const [billingUrl, setBillingUrl] = React.useState('')
const { enableBilling } = useProviderContext()
useEffect(() => {
if (!enableBilling && !isCurrentWorkspaceManager)
if (!enableBilling || !isCurrentWorkspaceOwner)
return
(async () => {
const { url } = await fetchBillingUrl()
setBillingUrl(url)
})()
}, [isCurrentWorkspaceManager])
}, [isCurrentWorkspaceOwner])
return (
<div>
<PlanComp loc={'billing-page'} />
{enableBilling && isCurrentWorkspaceManager && billingUrl && (
{enableBilling && isCurrentWorkspaceOwner && billingUrl && (
<a className='mt-5 flex px-6 justify-between h-12 items-center bg-gray-50 rounded-xl cursor-pointer' href={billingUrl} target='_blank'>
<div className='flex items-center'>
<ReceiptList className='w-4 h-4 text-gray-700' />