mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: use latest project used as default
This commit is contained in:
@@ -5,7 +5,8 @@ import type { PageLoad } from './$types';
|
||||
export const load: PageLoad = async ({ parent }) => {
|
||||
const { organizations } = await parent();
|
||||
if (organizations.total) {
|
||||
throw redirect(303, `${base}/console/organization-${organizations.teams[0].$id}`);
|
||||
const teamId = localStorage.getItem('organization') ?? organizations.teams[0].$id;
|
||||
throw redirect(303, `${base}/console/organization-${teamId}`);
|
||||
} else {
|
||||
throw redirect(303, `${base}/console/onboarding`);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ export const load: LayoutLoad = async ({ params, depends }) => {
|
||||
|
||||
try {
|
||||
const project = await sdkForConsole.projects.get(params.project);
|
||||
globalThis.localStorage.setItem('project', project.$id);
|
||||
globalThis.localStorage.setItem('organization', project.teamId);
|
||||
|
||||
return {
|
||||
project,
|
||||
|
||||
Reference in New Issue
Block a user