mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge pull request #1944 from appwrite/fix-credit-wrong-redirection
fix: credits wrong redirection
This commit is contained in:
2 files changed
+12
-12
No files matched your search
@@ -32,22 +32,18 @@
|
||||
await sdk.forConsole.account.create(ID.unique(), mail, pass, name ?? '');
|
||||
await sdk.forConsole.account.createEmailPasswordSession(mail, pass);
|
||||
|
||||
if ($redirectTo) {
|
||||
window.location.href = $redirectTo;
|
||||
return;
|
||||
}
|
||||
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
trackEvent(Submit.AccountCreate, { campaign_name: data?.couponData?.code });
|
||||
|
||||
if (data?.couponData?.code) {
|
||||
await goto(`${base}/apply-credit?code=${data?.couponData?.code}`);
|
||||
return;
|
||||
}
|
||||
if (data?.campaign) {
|
||||
} else if (data?.campaign?.$id) {
|
||||
await goto(`${base}/apply-credit?campaign=${data.campaign.$id}`);
|
||||
return;
|
||||
}
|
||||
if (page.url.searchParams) {
|
||||
} else if ($redirectTo) {
|
||||
window.location.href = $redirectTo;
|
||||
return;
|
||||
} else if (page.url.searchParams) {
|
||||
const redirect = page.url.searchParams.get('redirect');
|
||||
page.url.searchParams.delete('redirect');
|
||||
if (redirect) {
|
||||
@@ -60,6 +56,8 @@
|
||||
} else {
|
||||
await goto(base);
|
||||
}
|
||||
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
} catch (error) {
|
||||
disabled = false;
|
||||
addNotification({
|
||||
|
||||
+4
-2
@@ -31,17 +31,19 @@ const userVisitedEducationPage = (): boolean => {
|
||||
export const load: PageLoad = async ({ parent, url }) => {
|
||||
const { organizations, account } = await parent();
|
||||
|
||||
const isApplyingCredit = url.pathname.includes('apply-credit');
|
||||
|
||||
if (userVisitedEducationPage()) {
|
||||
await handleGithubEducationMembership(account.name, account.email);
|
||||
redirect(303, base);
|
||||
} else if (organizations.total) {
|
||||
} else if (organizations.total && !isApplyingCredit) {
|
||||
const teamId = account.prefs.organization ?? organizations.teams[0].$id;
|
||||
if (!teamId) {
|
||||
redirect(303, `${base}/account/organizations${url.search}`);
|
||||
} else {
|
||||
redirect(303, `${base}/organization-${teamId}${url.search}`);
|
||||
}
|
||||
} else {
|
||||
} else if (!isApplyingCredit) {
|
||||
redirect(303, `${base}/onboarding/create-project${url.search}`);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user