fix
This commit is contained in:
@@ -162,6 +162,7 @@
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
{#if activeTab !== "processed"}
|
||||
<div class="relative">
|
||||
<Button
|
||||
variant="default"
|
||||
@@ -294,6 +295,7 @@
|
||||
></button>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if activeTab === "needs_review" && onMarkAsProcessed}
|
||||
<Button
|
||||
|
||||
@@ -175,6 +175,10 @@
|
||||
})
|
||||
);
|
||||
const canQueueSync = $derived(enabled && hasCredentials && !needsReconnect);
|
||||
const hasDraftCredentials = $derived(
|
||||
store_url.trim() !== "" && consumer_key.trim() !== "" && consumer_secret.trim() !== ""
|
||||
);
|
||||
const canTestConnection = $derived(canAdmin && (hasCredentials || hasDraftCredentials));
|
||||
|
||||
function productSyncResultMessage(snap: StoreSyncSnapshot): string {
|
||||
const status = snap.status.toLowerCase();
|
||||
@@ -453,6 +457,19 @@
|
||||
success = "";
|
||||
testResult = null;
|
||||
try {
|
||||
// Test uses saved credentials — persist draft fields first when present.
|
||||
if (consumer_key.trim() || consumer_secret.trim() || !hasCredentials) {
|
||||
const config = await api<WooCommerceConfig>("/api/woocommerce", {
|
||||
method: "PUT",
|
||||
body: {
|
||||
store_url,
|
||||
consumer_key,
|
||||
consumer_secret,
|
||||
is_enabled: enabled
|
||||
}
|
||||
});
|
||||
applyConfig(config);
|
||||
}
|
||||
const result = await api<{ status?: string; message?: string }>("/api/woocommerce/test", {
|
||||
method: "POST"
|
||||
});
|
||||
@@ -974,12 +991,15 @@
|
||||
<Button
|
||||
type="button"
|
||||
loading={testing}
|
||||
disabled={!hasCredentials || !canAdmin}
|
||||
title={!hasCredentials ? i18n.t("store.saveBeforeTest") : undefined}
|
||||
disabled={!canTestConnection}
|
||||
title={!canTestConnection ? i18n.t("store.saveBeforeTest") : undefined}
|
||||
onclick={onTest}
|
||||
>
|
||||
{testing ? i18n.t("store.testing") : i18n.t("store.testConnection")}
|
||||
</Button>
|
||||
<Button type="submit" variant="outline" loading={saving} disabled={!canAdmin}>
|
||||
{saving ? i18n.t("store.saving") : i18n.t("woo.saveConfiguration")}
|
||||
</Button>
|
||||
{#if testResult}
|
||||
{#if testResult.success}
|
||||
<span class="flex items-center gap-2 text-sm text-green-600">
|
||||
|
||||
Reference in New Issue
Block a user