mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge pull request #1919 from appwrite/fix-undefined-organization-id
Fix undefined errors
This commit is contained in:
@@ -61,4 +61,4 @@ export const organization = derived(page, ($page) => $page.data?.organization as
|
||||
export const currentPlan = derived(page, ($page) => $page.data?.currentPlan as Plan);
|
||||
export const members = derived(page, ($page) => $page.data.members as Models.MembershipList);
|
||||
|
||||
export const regions = writable<Models.ConsoleRegionList | undefined>(undefined);
|
||||
export const regions = writable<Models.ConsoleRegionList>({ total: 0, regions: [] });
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import { getPlatformInfo } from '$lib/helpers/platform';
|
||||
import CreateProjectCloud from './createProjectCloud.svelte';
|
||||
import { organization, regions as regionsStore } from '$lib/stores/organization';
|
||||
import { regions as regionsStore } from '$lib/stores/organization';
|
||||
|
||||
export let data;
|
||||
|
||||
@@ -112,15 +112,11 @@
|
||||
}
|
||||
};
|
||||
onMount(async () => {
|
||||
if (isCloud && $organization.$id) {
|
||||
const regions = await sdk.forConsole.billing.listRegions($organization.$id);
|
||||
regionsStore.set(regions);
|
||||
checkPricingRefAndRedirect(page.url.searchParams);
|
||||
}
|
||||
checkPricingRefAndRedirect(page.url.searchParams);
|
||||
});
|
||||
|
||||
function findRegion(project: Models.Project) {
|
||||
return $regionsStore?.regions?.find((region) => region.$id === project.region);
|
||||
return $regionsStore.regions.find((region) => region.$id === project.region);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export async function loadAvailableRegions(orgId: string): Promise<void> {
|
||||
try {
|
||||
const storedRegions = get(regions);
|
||||
|
||||
if (storedRegions?.regions && lastLoadedOrganization === orgId) {
|
||||
if (storedRegions.regions && lastLoadedOrganization === orgId) {
|
||||
// already loaded for this organization, fast path return.
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user