mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
WIP on membership call
This commit is contained in:
@@ -705,6 +705,14 @@ export class Billing {
|
||||
);
|
||||
}
|
||||
|
||||
async setMembership(programId: string): Promise<void> {
|
||||
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<Coupon> {
|
||||
const path = `/console/coupons/${couponId}`;
|
||||
const params = {
|
||||
|
||||
@@ -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.
|
||||
</p>
|
||||
<Button fullWidth>
|
||||
<Button fullWidth on:click={onGithubLogin}>
|
||||
<span class="icon-github" aria-hidden="true" />
|
||||
<span class="text">Sign up with GitHub</span>
|
||||
</Button>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { base } from '$app/paths';
|
||||
import type { PageLoad } from './$types';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
|
||||
export const load: PageLoad = async ({ parent, url }) => {
|
||||
const { organizations, account } = await parent();
|
||||
@@ -13,6 +14,12 @@ export const load: PageLoad = async ({ parent, url }) => {
|
||||
redirect(303, `${base}/organization-${teamId}${url.search}`);
|
||||
}
|
||||
} else {
|
||||
const didRegisterGithubEducationProgram =
|
||||
localStorage.getItem('githubEducationProgram') === 'true';
|
||||
localStorage.removeItem('githubEducationProgram');
|
||||
if (didRegisterGithubEducationProgram) {
|
||||
await sdk.forConsole.billing.setMembership('github-student-developer');
|
||||
}
|
||||
redirect(303, `${base}/onboarding${url.search}`);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user