This commit is contained in:
Darshan
2025-08-31 13:59:22 +05:30
parent 6c32219c15
commit 92a2be06dc
2 changed files with 26 additions and 10 deletions
+19 -3
View File
@@ -2,10 +2,26 @@ import { redirect } from '@sveltejs/kit';
import { base } from '$app/paths';
import type { LayoutLoad } from './$types';
export const load: LayoutLoad = async ({ parent }) => {
export const load: LayoutLoad = async ({ parent, url }) => {
const { account } = await parent();
if (!account) {
redirect(303, base);
const projectId = url.searchParams.get('projectId');
const repositoryId = url.searchParams.get('repositoryId');
const installationId = url.searchParams.get('installationId');
const providerPullRequestId = url.searchParams.get('providerPullRequestId');
if (!installationId || !repositoryId || !providerPullRequestId) {
redirect(303, `${base}`);
}
if (!account) {
redirect(303, `${base}`);
}
return {
projectId,
repositoryId,
installationId,
providerPullRequestId
};
};
@@ -1,5 +1,4 @@
<script lang="ts">
import { page } from '$app/state';
import { app } from '$lib/stores/app';
import AppwriteLogoDark from '$lib/images/appwrite-logo-dark.svg';
import AppwriteLogoLight from '$lib/images/appwrite-logo-light.svg';
@@ -7,6 +6,8 @@
import { onMount } from 'svelte';
import { getApiEndpoint } from '$lib/stores/sdk';
export let data;
const endpoint = getApiEndpoint();
const client = new Client();
const vcs = new Vcs(client);
@@ -15,17 +16,16 @@
let repositoryId: string;
let providerPullRequestId: string;
let loading = false;
let error = '';
let success = '';
let loading = false;
onMount(async () => {
const projectId = page.url.searchParams.get('projectId');
client.setEndpoint(endpoint).setProject(projectId).setMode('admin');
repositoryId = data.repositoryId;
installationId = data.installationId;
providerPullRequestId = data.providerPullRequestId;
installationId = page.url.searchParams.get('installationId');
repositoryId = page.url.searchParams.get('repositoryId');
providerPullRequestId = page.url.searchParams.get('providerPullRequestId') + '';
client.setEndpoint(endpoint).setProject(data.projectId).setMode('admin');
});
async function approveDeployment() {