5htp-core 0.6.0-94 → 0.6.0-95

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.
@@ -236,9 +236,19 @@ export default ({
236
236
  if (disabled)
237
237
  return false;
238
238
 
239
+ // Custom event
240
+ if (props.onClick !== undefined) {
241
+
242
+ const returned = props.onClick(e);
243
+ if (async && returned?.then) {
244
+ setLoading(true);
245
+ returned.finally(() => setLoading(false));
246
+ }
247
+ }
248
+
239
249
  // Link
240
250
  let nativeEvent: boolean = false;
241
- if ('link' in props) {
251
+ if (('link' in props) && !e.defaultPrevented) {
242
252
 
243
253
  // Nouvelle fenetre = event par defaut
244
254
  if (props.target === '_blank') {
@@ -257,16 +267,6 @@ export default ({
257
267
  }
258
268
  }
259
269
 
260
- // Custom event
261
- if (props.onClick !== undefined) {
262
-
263
- const returned = props.onClick(e);
264
- if (async && returned?.then) {
265
- setLoading(true);
266
- returned.finally(() => setLoading(false));
267
- }
268
- }
269
-
270
270
  if (!nativeEvent) {
271
271
  e.preventDefault();
272
272
  return false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp-core",
3
3
  "description": "Convenient TypeScript framework designed for Performance and Productivity.",
4
- "version": "0.6.0-94",
4
+ "version": "0.6.0-95",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-core.git",
7
7
  "license": "MIT",
@@ -637,7 +637,9 @@ export default class ServerRouter
637
637
 
638
638
  // Don't exose technical errors to users
639
639
  if (this.app.env.profile === 'prod')
640
- e.message = "We encountered an internal error, and our team has just been notified. Sorry for the inconvenience.";
640
+ e = new Error(
641
+ "We encountered an internal error, and our team has just been notified. Sorry for the inconvenience."
642
+ );
641
643
 
642
644
  } else {
643
645