Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fix: dashboard actions refused by the server now show the reason (#14720)

Damian Legawiec0cb1a17458b2
diff --git a/packages/dashboard/src/components/spree/orders/order-header.tsx b/packages/dashboard/src/components/spree/orders/order-header.tsx
index 2a95a6c9c9..a38f944430 100644
--- a/packages/dashboard/src/components/spree/orders/order-header.tsx
+++ b/packages/dashboard/src/components/spree/orders/order-header.tsx
@@ -51,6 +51,7 @@ export function OrderHeader({ order }: { order: Order }) {
// divided.
successMessage: false,
errorMessage: t('admin.orders.detail.errors.complete_failed'),
+ showValidationErrors: true,
onSuccess: (result) => {
if (!isOrderGroup(result)) {
toastManager.add({ type: 'success', title: t('admin.orders.detail.messages.completed') })
diff --git a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
index 52d180f99e..052f8ff005 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
@@ -597,6 +597,7 @@ function ScheduleCard({ form }: { form: UseFormReturn<PromotionFormValues> }) {
/>
)}
/>
+ <FieldError errors={[errors.expires_at]} />
</Field>
<Field>
<FieldLabel htmlFor="usage_limit">
diff --git a/packages/dashboard/src/hooks/use-companies.ts b/packages/dashboard/src/hooks/use-companies.ts
index ccc27b7991..3d698d456a 100644
--- a/packages/dashboard/src/hooks/use-companies.ts
+++ b/packages/dashboard/src/hooks/use-companies.ts
@@ -165,6 +165,7 @@ export function useAddCompanyMember(companyId: string) {
],
successMessage: i18n.t('admin.company_memberships.messages.added'),
errorMessage: i18n.t('admin.errors.failed_to_create'),
+ showValidationErrors: true,
})
}
diff --git a/packages/dashboard/src/hooks/use-promotions.ts b/packages/dashboard/src/hooks/use-promotions.ts
index c682bb833c..087400d8f4 100644
--- a/packages/dashboard/src/hooks/use-promotions.ts
+++ b/packages/dashboard/src/hooks/use-promotions.ts
@@ -58,6 +58,7 @@ export function useDeletePromotion() {
invalidate: [['promotions']],
successMessage: i18n.t('admin.messages.promotion_deleted'),
errorMessage: i18n.t('admin.errors.failed_to_delete'),
+ showValidationErrors: true,
onSuccess: (_data, id) => {
queryClient.removeQueries({ queryKey: buildKey('promotions', id) })
},
diff --git a/packages/dashboard/src/hooks/use-stock-levels.ts b/packages/dashboard/src/hooks/use-stock-levels.ts
index babb0a69db..7028ac4f1c 100644
--- a/packages/dashboard/src/hooks/use-stock-levels.ts
+++ b/packages/dashboard/src/hooks/use-stock-levels.ts
@@ -62,6 +62,7 @@ export function useUpdateStockLevel(id: string, extraInvalidate: QueryKey[] = []
invalidate: [['stock-levels', id], ...extraInvalidate],
successMessage: i18n.t('admin.stock_levels.messages.stock_updated'),
errorMessage: i18n.t('admin.errors.failed_to_update'),
+ showValidationErrors: true,
onSuccess: (updated) => {
queryClient.setQueriesData<{ data: StockLevel[] }>(
{ queryKey: buildKey('stock-levels') },