hotfix
This commit is contained in:
parent
d4b05a0728
commit
ca2c695a01
1 changed files with 14 additions and 3 deletions
|
@ -38,10 +38,15 @@ export async function getActiveProjectId(): Promise<string> {
|
||||||
return projectId ?? "";
|
return projectId ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getActiveProjectConfiguration(): Promise<AppwriteProjectConfiguration> {
|
export async function getActiveProjectConfiguration(): Promise<AppwriteProjectConfiguration | undefined> {
|
||||||
const configurations = await getAppwriteProjects();
|
const configurations = await getAppwriteProjects();
|
||||||
const activeConfigId = await getActiveProjectId();
|
const activeConfigId = await getActiveProjectId();
|
||||||
let activeConfig;
|
let activeConfig;
|
||||||
|
|
||||||
|
if (configurations === undefined || configurations?.length === 0) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
configurations.forEach((config) => {
|
configurations.forEach((config) => {
|
||||||
if (config.projectId === activeConfigId) {
|
if (config.projectId === activeConfigId) {
|
||||||
activeConfig = config;
|
activeConfig = config;
|
||||||
|
@ -58,7 +63,10 @@ export async function getActiveProjectConfiguration(): Promise<AppwriteProjectCo
|
||||||
export async function setActiveProjectId(projectId: string): Promise<void> {
|
export async function setActiveProjectId(projectId: string): Promise<void> {
|
||||||
const configuration = workspace.getConfiguration("appwrite");
|
const configuration = workspace.getConfiguration("appwrite");
|
||||||
await configuration.update("activeProjectId", projectId, true);
|
await configuration.update("activeProjectId", projectId, true);
|
||||||
initAppwriteClient(await getActiveProjectConfiguration());
|
const active = await getActiveProjectConfiguration();
|
||||||
|
if (active) {
|
||||||
|
initAppwriteClient(active);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateActiveProjectId(): Promise<void> {
|
export async function updateActiveProjectId(): Promise<void> {
|
||||||
|
@ -66,7 +74,10 @@ export async function updateActiveProjectId(): Promise<void> {
|
||||||
if (projects.length > 0) {
|
if (projects.length > 0) {
|
||||||
const configuration = workspace.getConfiguration("appwrite");
|
const configuration = workspace.getConfiguration("appwrite");
|
||||||
await configuration.update("activeProjectId", projects[0].projectId, true);
|
await configuration.update("activeProjectId", projects[0].projectId, true);
|
||||||
initAppwriteClient(await getActiveProjectConfiguration());
|
const active = await getActiveProjectConfiguration();
|
||||||
|
if (active) {
|
||||||
|
initAppwriteClient(active);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue