From 63ba5e31c9db79df7dc2201baee37740bbc2c7b7 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 9 Feb 2023 06:37:35 +0545 Subject: [PATCH] update project plan --- src/lib/stores/billing.ts | 20 ++++++++- .../settings/+page.svelte | 4 +- .../project-[project]/settings/+page.svelte | 45 ++++++++++++++++++- 3 files changed, 64 insertions(+), 5 deletions(-) diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index 0ecfcff2a..bd96d4981 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -1,4 +1,4 @@ -import type { Client } from '@aw-labs/appwrite-console'; +import type { Client, Payload } from '@aw-labs/appwrite-console'; export class Billing { client: Client; @@ -15,7 +15,23 @@ export class Billing { 'POST', uri, { - 'Content-Type': 'application/json' + 'content-type': 'application/json' + }, + params + ); + } + + async updateProjectPlan(projectId: string, billingPlan: string) { + const path = `/project/${projectId}/plan`; + const params: Payload = { + billingPlan + }; + const uri = new URL(this.client.config.endpoint + path); + return await this.client.call( + 'patch', + uri, + { + 'content-type': 'application/json' }, params ); diff --git a/src/routes/console/organization-[organization]/settings/+page.svelte b/src/routes/console/organization-[organization]/settings/+page.svelte index dc7e25519..f8ae121c6 100644 --- a/src/routes/console/organization-[organization]/settings/+page.svelte +++ b/src/routes/console/organization-[organization]/settings/+page.svelte @@ -118,7 +118,7 @@ -
+ Create Payment Method
@@ -130,7 +130,7 @@ - +
diff --git a/src/routes/console/project-[project]/settings/+page.svelte b/src/routes/console/project-[project]/settings/+page.svelte index 76277fbf2..c8cfc0d86 100644 --- a/src/routes/console/project-[project]/settings/+page.svelte +++ b/src/routes/console/project-[project]/settings/+page.svelte @@ -1,5 +1,5 @@