forked from github/plane
fix: cloud fixes
This commit is contained in:
parent
912851659c
commit
1a0f912ab4
@ -23,16 +23,16 @@ export const UpgradeWorkspaceModal: FC<IUpgradeWorkspaceModal> = observer((props
|
|||||||
// fetching products
|
// fetching products
|
||||||
const { data: products } = useSWR("UPGRADE_PRODUCTS", () => licenseService.getProducts());
|
const { data: products } = useSWR("UPGRADE_PRODUCTS", () => licenseService.getProducts());
|
||||||
|
|
||||||
console.log("products", products);
|
|
||||||
|
|
||||||
const handleUpgrade = (product: any) => {
|
const handleUpgrade = (product: any) => {
|
||||||
if (currentUser && workspaceMembers && workspaceMembers?.length >= 1 && currentWorkspace) {
|
if (currentUser && workspaceMembers && workspaceMembers?.length >= 1 && currentWorkspace) {
|
||||||
// licenseService.createSubscription(currentUser, product?.default_price?.id).then((response) => {
|
|
||||||
// console.log("subscription", response);
|
|
||||||
// });
|
|
||||||
|
|
||||||
licenseService
|
licenseService
|
||||||
.createCheckoutSession(product?.default_price?.id, workspaceMembers?.length, currentWorkspace, currentUser)
|
.createCheckoutSession(
|
||||||
|
product?.default_price?.id,
|
||||||
|
workspaceMembers?.length,
|
||||||
|
currentWorkspace,
|
||||||
|
currentUser,
|
||||||
|
product?.metadata
|
||||||
|
)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log("subscription", response);
|
console.log("subscription", response);
|
||||||
window.open(response.url, "_blank");
|
window.open(response.url, "_blank");
|
||||||
|
@ -23,8 +23,14 @@ export class LicenseService extends APIService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async createCheckoutSession(priceId: string, seats: number, workspace: IWorkspace, user: IUser): Promise<any> {
|
async createCheckoutSession(
|
||||||
return this.post(`/api/checkout/create-session/`, { priceId, seats, workspace, user })
|
priceId: string,
|
||||||
|
seats: number,
|
||||||
|
workspace: IWorkspace,
|
||||||
|
user: IUser,
|
||||||
|
metadata: any
|
||||||
|
): Promise<any> {
|
||||||
|
return this.post(`/api/checkout/create-session/`, { priceId, seats, workspace, user, metadata })
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
|
Loading…
Reference in New Issue
Block a user