Skip to content

Commit

Permalink
Merge pull request #671 from appwrite/fix-organization-persistency
Browse files Browse the repository at this point in the history
fix: org presistency when switchin org
  • Loading branch information
lohanidamodar authored Dec 20, 2023
2 parents 4794793 + 1ca379f commit 97ecbb6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/routes/console/organization-[organization]/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Header from './header.svelte';
import { headerAlert } from '$lib/stores/headerAlert';
import ProjectsAtRisk from '$lib/components/billing/alerts/projectsAtRisk.svelte';
import { get } from 'svelte/store';
import { preferences } from '$lib/stores/preferences';

export const load: LayoutLoad = async ({ params, depends }) => {
depends(Dependencies.ORGANIZATION);
Expand All @@ -28,13 +29,20 @@ export const load: LayoutLoad = async ({ params, depends }) => {
}

try {
const prefs = await sdk.forConsole.account.getPrefs();
const newPrefs = { ...prefs, organization: params.organization };
sdk.forConsole.account.updatePrefs(newPrefs);
preferences.loadTeamPrefs(params.organization);
return {
header: Header,
breadcrumbs: Breadcrumbs,
organization: await sdk.forConsole.teams.get(params.organization),
members: await sdk.forConsole.teams.listMemberships(params.organization)
};
} catch (e) {
const prefs = await sdk.forConsole.account.getPrefs();
const newPrefs = { ...prefs, organization: '' };
sdk.forConsole.account.updatePrefs(newPrefs);
localStorage.removeItem('organization');
throw error(e.code, e.message);
}
Expand Down

3 comments on commit 97ecbb6

@vercel
Copy link

@vercel vercel bot commented on 97ecbb6 Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

console-preview – ./

console-preview-appwrite.vercel.app
console-next.vercel.app
console-preview-git-main-appwrite.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 97ecbb6 Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

console-cloud – ./

console-cloud-appwrite.vercel.app
console-cloud-git-main-appwrite.vercel.app
console-cloud.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 97ecbb6 Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.