Skip to content

Commit

Permalink
Merge pull request #397 from appwrite/fix-team-preferences
Browse files Browse the repository at this point in the history
fix: team prefs
  • Loading branch information
TorstenDittmann authored Apr 12, 2023
2 parents be3d991 + 86bbcfd commit ac4181a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/lib/stores/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ function createPreferences() {

return n;
}),
loadTeamPrefs: async () => {
const id = get(organization)?.$id;
if (!id) return {};
loadTeamPrefs: async (id: string) => {
const teamPrefs = await sdk.forConsole.teams.getPrefs(id);
update((n) => {
n[id] = teamPrefs;
Expand Down
2 changes: 2 additions & 0 deletions src/routes/console/project-[project]/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Dependencies } from '$lib/constants';
import { sdk } from '$lib/stores/sdk';
import { error } from '@sveltejs/kit';
import type { LayoutLoad } from './$types';
import { preferences } from '$lib/stores/preferences';

export const load: LayoutLoad = async ({ params, depends }) => {
depends(Dependencies.PROJECT);
Expand All @@ -10,6 +11,7 @@ export const load: LayoutLoad = async ({ params, depends }) => {
const project = await sdk.forConsole.projects.get(params.project);
localStorage.setItem('project', project.$id);
localStorage.setItem('organization', project.teamId);
preferences.loadTeamPrefs(project.teamId);

return {
project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import Header from './header.svelte';
import { error } from '@sveltejs/kit';
import SubNavigation from './subNavigation.svelte';
import { Query } from '@appwrite.io/console';
import { preferences } from '$lib/stores/preferences';

export const load: LayoutLoad = async ({ params, depends }) => {
await preferences.loadTeamPrefs();
depends(Dependencies.COLLECTION);
try {
return {
Expand Down

3 comments on commit ac4181a

@vercel
Copy link

@vercel vercel bot commented on ac4181a Apr 12, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on ac4181a Apr 12, 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.vercel.app
console-cloud-appwrite.vercel.app
console-cloud-git-main-appwrite.vercel.app

@vercel
Copy link

@vercel vercel bot commented on ac4181a Apr 12, 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.