fix: add store for project team

This commit is contained in:
Torsten Dittmann committed 2022-07-26 18:43:13 +02:00
1 parent 24d7eb9810
commit 0ecc38540f
2 files changed
+20 -7

No files matched your search

+6 -7
View File
@@ -4,7 +4,7 @@
import { sdkForConsole, setProject } from '$lib/stores/sdk';
import { collection } from './databases/database/[database]/collection/[collection]/store';
import { UploadBox } from '$lib/components';
import { project } from './store';
import { organisation, project } from './store';
import { onMount } from 'svelte';
import { afterNavigate } from '$app/navigation';
import { updateLayout } from '$lib/stores/layout';
@@ -50,12 +50,11 @@
async function handle(event = null) {
if ($project?.$id !== projectId) {
setProject(projectId);
if (browser) {
await project.load(projectId);
}
await project.load(projectId);
}
if ($organisation?.$id !== $project.teamId) {
await organisation.load($project.teamId);
}
// TODO: load organization
// const organisation = await sdkForConsole.teams.get($project.teamId);
updateLayout({
navigate: event,
@@ -64,7 +63,7 @@
breadcrumbs: [
{
href: '#',
title: $project.name,
title: $organisation.name,
level: 1
},
{
+14
View File
@@ -15,4 +15,18 @@ function createProject() {
};
}
function createOrganisation() {
const { subscribe, set } = writable<Models.Team>();
return {
subscribe,
set,
load: async (teamId: string) => {
const team = await sdkForConsole.teams.get(teamId);
set(team);
}
};
}
export const project = createProject();
export const organisation = createOrganisation();