mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: handle missing deploymentId gracefully
This commit is contained in:
+16
-6
@@ -15,17 +15,27 @@ export const load: PageLoad = async ({ params, depends, url, route, parent }) =>
|
||||
|
||||
const parsedQueries = queryParamToMap(query || '[]');
|
||||
queries.set(parsedQueries);
|
||||
let activeDeployment = null;
|
||||
if (data.function.deploymentId) {
|
||||
try {
|
||||
activeDeployment = await sdk
|
||||
.forProject(params.region, params.project)
|
||||
.functions.getDeployment({
|
||||
functionId: params.function,
|
||||
deploymentId: data.function.deploymentId
|
||||
});
|
||||
} catch (error) {
|
||||
// active deployment with the requested ID could not be found
|
||||
activeDeployment = null;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
query,
|
||||
installations: data.installations,
|
||||
activeDeployment: data.function.deploymentId
|
||||
? await sdk.forProject(params.region, params.project).functions.getDeployment({
|
||||
functionId: params.function,
|
||||
deploymentId: data.function.deploymentId
|
||||
})
|
||||
: null,
|
||||
activeDeployment,
|
||||
deploymentList: await sdk
|
||||
.forProject(params.region, params.project)
|
||||
.functions.listDeployments({
|
||||
|
||||
@@ -46,11 +46,18 @@ export const load = async ({ params, depends, parent }) => {
|
||||
})
|
||||
]);
|
||||
|
||||
const deployment = deploymentList?.total
|
||||
? await sdk
|
||||
.forProject(params.region, params.project)
|
||||
.sites.getDeployment({ siteId: params.site, deploymentId: site.deploymentId })
|
||||
: null;
|
||||
let deployment = null;
|
||||
if (deploymentList?.total && site.deploymentId) {
|
||||
try {
|
||||
deployment = await sdk
|
||||
.forProject(params.region, params.project)
|
||||
.sites.getDeployment({ siteId: params.site, deploymentId: site.deploymentId });
|
||||
} catch (error) {
|
||||
// active deployment with the requested ID could not be found
|
||||
deployment = null;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
site,
|
||||
deploymentList,
|
||||
|
||||
+13
-6
@@ -37,17 +37,24 @@ export const load = async ({ params, depends, url, route, parent }) => {
|
||||
sdk.forProject(params.region, params.project).vcs.listInstallations()
|
||||
]);
|
||||
|
||||
let activeDeployment = null;
|
||||
if (site.deploymentId && deploymentList?.total) {
|
||||
try {
|
||||
activeDeployment = await sdk
|
||||
.forProject(params.region, params.project)
|
||||
.sites.getDeployment({ siteId: params.site, deploymentId: site.deploymentId });
|
||||
} catch (error) {
|
||||
// active deployment with the requested ID could not be found
|
||||
activeDeployment = null;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
query,
|
||||
deploymentList,
|
||||
activeDeployment:
|
||||
site.deploymentId && deploymentList?.total
|
||||
? await sdk
|
||||
.forProject(params.region, params.project)
|
||||
.sites.getDeployment({ siteId: params.site, deploymentId: site.deploymentId })
|
||||
: null,
|
||||
activeDeployment,
|
||||
installations
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user