@nuasite/components 0.0.39 → 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@nuasite/components",
3
3
  "description": "Nua Site astro components.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.0.39",
5
+ "version": "0.0.40",
6
6
  "files": [
7
7
  "dist/**",
8
8
  "src/**",
@@ -254,15 +254,17 @@ const tokenId = `${tokenFieldName}_${formId}`
254
254
  headers: { 'X-Requested-With': 'XMLHttpRequest' },
255
255
  })
256
256
 
257
- let result = {};
257
+ let result: any = {};
258
258
  try { result = await response.json() } catch {}
259
259
 
260
260
  if (response.ok && 'success' in result && result.success) {
261
- showSuccess(successMessage)
261
+ const message = result.message || successMessage
262
+ showSuccess(message)
262
263
  form.reset()
263
264
  refreshSubmissionGuards()
264
265
  } else {
265
- showError(errorMessage)
266
+ const message = result.error || result.message || errorMessage
267
+ showError(message)
266
268
  }
267
269
  } catch (err) {
268
270
  console.error('Form submission error:', err);