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