|
5 | 5 | import { Badge, Layout, Typography } from '@appwrite.io/pink-svelte'; |
6 | 6 | import { Button } from '$lib/elements/forms'; |
7 | 7 |
|
8 | | - export let data; |
| 8 | + const { data } = $props(); |
9 | 9 |
|
10 | 10 | const endpoint = getApiEndpoint(); |
11 | 11 | const client = new Client(); |
12 | 12 | const vcs = new Vcs(client); |
13 | 13 |
|
14 | | - let installationId: string; |
15 | | - let repositoryId: string; |
16 | | - let providerPullRequestId: string; |
17 | | -
|
18 | | - let error = ''; |
19 | | - let success = ''; |
20 | | - let loading = false; |
| 14 | + let error = $state(''); |
| 15 | + let success = $state(''); |
| 16 | + let loading = $state(false); |
21 | 17 |
|
22 | 18 | onMount(async () => { |
23 | | - repositoryId = data.repositoryId; |
24 | | - installationId = data.installationId; |
25 | | - providerPullRequestId = data.providerPullRequestId; |
26 | | -
|
27 | 19 | client.setEndpoint(endpoint).setProject(data.projectId).setMode('admin'); |
28 | 20 | }); |
29 | 21 |
|
|
38 | 30 |
|
39 | 31 | try { |
40 | 32 | await vcs.updateExternalDeployments({ |
41 | | - installationId, |
42 | | - repositoryId, |
43 | | - providerPullRequestId |
| 33 | + installationId: data.installationId, |
| 34 | + repositoryId: data.repositoryId, |
| 35 | + providerPullRequestId: data.providerPullRequestId |
44 | 36 | }); |
45 | 37 | success = 'Deployment approved successfully! Build will start soon.'; |
46 | 38 | } catch (e) { |
|
58 | 50 | <Badge type="error" variant="secondary" content={error} /> |
59 | 51 | {/if} |
60 | 52 | <Typography.Title size="l" align="center"> |
61 | | - The deployment for pull request #{providerPullRequestId} |
| 53 | + The deployment for pull request #{data.providerPullRequestId} |
62 | 54 | is awaiting approval. When authorized, deployments will be started. |
63 | 55 | </Typography.Title> |
64 | 56 | <Button on:click={approveDeployment} secondary>Approve Deployment</Button> |
|
0 commit comments