mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Allow the GitHub Education to be applied when the user is already signed in
This commit is contained in:
+10
-6
@@ -6,11 +6,15 @@ import { sdk } from '$lib/stores/sdk';
|
||||
const handleGithubEducationMembership = async (name: string, email: string) => {
|
||||
const result = await sdk.forConsole.billing.setMembership('github-student-developer');
|
||||
if (result && 'error' in result) {
|
||||
await sdk.forConsole.account.deleteSession('current');
|
||||
redirect(
|
||||
303,
|
||||
`${base}/education/error?message=${result.error.message}&code=${result.error.code}`
|
||||
);
|
||||
if (result.error.code === 409) {
|
||||
redirect(303, `${base}/account/organizations`);
|
||||
} else {
|
||||
await sdk.forConsole.account.deleteSession('current');
|
||||
redirect(
|
||||
303,
|
||||
`${base}/education/error?message=${result.error.message}&code=${result.error.code}`
|
||||
);
|
||||
}
|
||||
} else if (result && '$createdAt' in result) {
|
||||
setToGhStudentMailingList(name, email);
|
||||
}
|
||||
@@ -20,7 +24,7 @@ const userVisitedEducationPage = (): boolean => {
|
||||
const didRegisterGithubEducationProgram =
|
||||
localStorage.getItem('githubEducationProgram') === 'true';
|
||||
localStorage.removeItem('githubEducationProgram');
|
||||
return didRegisterGithubEducationProgram;
|
||||
return didRegisterGithubEducationProgram || location.pathname.includes('education');
|
||||
};
|
||||
|
||||
export const load: PageLoad = async ({ parent, url }) => {
|
||||
|
||||
Reference in New Issue
Block a user