Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/routes/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const load: LayoutLoad = async ({ depends, url }) => {
depends(Dependencies.ACCOUNT);

try {
const account = await sdk.forConsole.account.get();
const account = await sdk.forConsole.account.get<{ organization?: string }>();

LogRocket.identify(account.$id, {
name: account.name,
Expand Down
4 changes: 2 additions & 2 deletions src/routes/console/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';

export const load: PageLoad = async ({ parent }) => {
const { organizations } = await parent();
const { organizations, account } = await parent();
if (organizations.total) {
const teamId = localStorage.getItem('organization') ?? organizations.teams[0].$id;
const teamId = account.prefs.organization ?? organizations.teams[0].$id;
throw redirect(303, `${base}/console/organization-${teamId}`);
} else {
throw redirect(303, `${base}/console/onboarding`);
Expand Down
3 changes: 1 addition & 2 deletions src/routes/console/project-[project]/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ export const load: LayoutLoad = async ({ params, depends }) => {

try {
const project = await sdk.forConsole.projects.get(params.project);
localStorage.setItem('project', project.$id);
localStorage.setItem('organization', project.teamId);
sdk.forConsole.account.updatePrefs({ organization: project.teamId });
preferences.loadTeamPrefs(project.teamId);

return {
Expand Down