|
6 | 6 | import { page } from '$app/state'; |
7 | 7 | import { accountV1Api } from '$lib/api'; |
8 | 8 | import type { OAuthConnectionResponse } from '$lib/api/internal/v1/models'; |
9 | | - import { OAuthAuthorize, OAuthListProviders } from '$lib/api/next/oauth'; |
| 9 | + import { OAuthListProviders } from '$lib/api/next/oauth'; |
10 | 10 | import Container from '$lib/components/Container.svelte'; |
11 | 11 | import { Button } from '$lib/components/ui/button'; |
12 | 12 | import * as Card from '$lib/components/ui/card'; |
|
21 | 21 | let loading = $state(false); // overall refresh button state |
22 | 22 | let loadingProviders = $state(true); |
23 | 23 | let loadingConnections = $state(true); |
24 | | - let actionBusy = $state<string | null>(null); // providerKey currently acting on |
25 | 24 |
|
26 | 25 | // From redirect (?status=) |
27 | 26 | let queryStatus = $derived(page.url.searchParams.get('status')); |
|
82 | 81 | return connections.find((c) => c.providerKey === key)?.displayName ?? null; |
83 | 82 | } |
84 | 83 |
|
85 | | - // Start an OAuth flow via your backend redirect |
86 | | - async function beginLink(providerKey: string) { |
87 | | - actionBusy = providerKey; |
88 | | - try { |
89 | | - await OAuthAuthorize(providerKey, 'Link'); |
90 | | - } catch (err) { |
91 | | - await handleApiError(err); |
92 | | - } finally { |
93 | | - actionBusy = null; |
94 | | - } |
95 | | - } |
96 | | -
|
97 | 84 | // Open confirm dialog for disconnect |
98 | 85 | function confirmDisconnect(providerKey: string) { |
99 | 86 | const existing = connections.find((c) => c.providerKey === providerKey); |
|
145 | 132 | {:else} |
146 | 133 | {#each providers as p} |
147 | 134 | {#if !isConnected(p)} |
148 | | - <Dropdown.Item |
149 | | - onclick={() => beginLink(p)} |
150 | | - data-provider={p} |
151 | | - disabled={actionBusy === p} |
152 | | - > |
153 | | - <Link2 class="mr-2 size-4" /> |
154 | | - {actionBusy === p ? `Starting ${p}…` : p} |
| 135 | + <Dropdown.Item> |
| 136 | + <Link2 class="mr-2 size-4" /> <!-- TODO: Form + button [POST] --> |
155 | 137 | </Dropdown.Item> |
156 | 138 | {/if} |
157 | 139 | {/each} |
|
0 commit comments