From a8a9e4ca0ee1919df3ab67da48c9876648c7b5c3 Mon Sep 17 00:00:00 2001
From: ernstmul
Date: Thu, 3 Oct 2024 10:22:15 +0200
Subject: [PATCH] WIP on membership call
---
src/lib/sdk/billing.ts | 8 ++++++++
.../register/github-education-program/+page.svelte | 7 ++++---
src/routes/+page.ts | 7 +++++++
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts
index a665d2e72..b3e6736c2 100644
--- a/src/lib/sdk/billing.ts
+++ b/src/lib/sdk/billing.ts
@@ -705,6 +705,14 @@ export class Billing {
);
}
+ async setMembership(programId: string): Promise {
+ const path = `/console/programs/${programId}/memberships`;
+ const uri = new URL(this.client.config.endpoint + path);
+ return await this.client.call('POST', uri, {
+ 'content-type': 'application/json'
+ });
+ }
+
async getCoupon(couponId: string): Promise {
const path = `/console/coupons/${couponId}`;
const params = {
diff --git a/src/routes/(public)/(guest)/register/github-education-program/+page.svelte b/src/routes/(public)/(guest)/register/github-education-program/+page.svelte
index 59a2f6567..d29f1b8e5 100644
--- a/src/routes/(public)/(guest)/register/github-education-program/+page.svelte
+++ b/src/routes/(public)/(guest)/register/github-education-program/+page.svelte
@@ -28,10 +28,11 @@
}
function onGithubLogin() {
+ localStorage.setItem('githubEducationProgram', 'true');
sdk.forConsole.account.createOAuth2Session(
OAuthProvider.Github,
- window.location.origin,
- window.location.origin,
+ window.location.origin + '/console/register/github-education-program?success',
+ window.location.origin + '/console/register/github-education-program?failure',
['read:user', 'user:email']
);
}
@@ -71,7 +72,7 @@
Enjoy Appwrite Cloud for free throughout your student journey as part of the GitHub
Student Developer Pack.
-