2
0

(lp) Add custom chats and storage in pricing cards

This commit is contained in:
Baptiste Arnaud
2022-10-19 08:29:33 +02:00
parent 7b0bd08dc8
commit 57c814ceca
6 changed files with 497 additions and 171 deletions

View File

@ -18,15 +18,19 @@ const DashboardPage = () => {
const { workspace } = useWorkspace()
useEffect(() => {
const subscribePlan = query.subscribePlan as Plan | undefined
const { subscribePlan, chats, storage } = query as {
subscribePlan: Plan | undefined
chats: string | undefined
storage: string | undefined
}
if (workspace && subscribePlan && user && workspace.plan === 'FREE') {
setIsLoading(true)
pay({
user,
plan: subscribePlan,
workspaceId: workspace.id,
additionalChats: 0,
additionalStorage: 0,
additionalChats: chats ? parseInt(chats) : 0,
additionalStorage: storage ? parseInt(storage) : 0,
})
}
}, [query, user, workspace])