Merge pull request #692 from appwrite/fix-redirection-issue

fix: wrong redirection
This commit is contained in:
Eldad A. Fux
2023-12-28 10:10:34 +01:00
committed by GitHub
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -7,7 +7,9 @@ export const load: PageLoad = async ({ parent, url }) => {
if (organizations.total) {
const teamId = account.prefs.organization ?? organizations.teams[0].$id;
throw redirect(303, `${base}/console/organization-${teamId}${url.search ?? ''}`);
if (!teamId) {
throw redirect(303, `${base}/console/account/organizations${url.search ?? ''}`);
} else throw redirect(303, `${base}/console/organization-${teamId}${url.search ?? ''}`);
} else {
throw redirect(303, `${base}/console/onboarding${url.search ?? ''}`);
}
@@ -41,7 +41,7 @@ export const load: LayoutLoad = async ({ params, depends }) => {
};
} catch (e) {
const prefs = await sdk.forConsole.account.getPrefs();
const newPrefs = { ...prefs, organization: '' };
const newPrefs = { ...prefs, organization: null };
sdk.forConsole.account.updatePrefs(newPrefs);
localStorage.removeItem('organization');
throw error(e.code, e.message);