Skip to content

Commit

Permalink
fix: wrong redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
ArmanNik committed Dec 28, 2023
1 parent 7a69d59 commit 6f9e053
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/routes/console/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? ''}`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/routes/console/organization-[organization]/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6f9e053

Please sign in to comment.