@dile/crud
Advanced tools
Comparing version 0.0.27 to 0.0.28
@@ -7,4 +7,5 @@ import { LitElement, html, css } from 'lit'; | ||
import { ResponseApiAdapter } from '../../../lib/ResponseApiAdapter.js'; | ||
import { DileI18nMixin } from '../../../lib/DileI18nMixin.js'; | ||
export class DileAjaxForm extends LitElement { | ||
export class DileAjaxForm extends DileI18nMixin(LitElement) { | ||
static styles = [ | ||
@@ -92,2 +93,3 @@ css` | ||
@ajax-error="${this.doErrorGet}" | ||
language="${this.language}" | ||
></dile-ajax> | ||
@@ -100,2 +102,3 @@ <dile-ajax | ||
@ajax-error="${this.doErrorSave}" | ||
language="${this.language}" | ||
></dile-ajax> | ||
@@ -192,3 +195,3 @@ ` | ||
} | ||
throw "Operation not supported in fct-ajax-form use 'insert' or 'update'"; | ||
throw this.translations.ajax_form_not_supported; | ||
} | ||
@@ -227,7 +230,7 @@ | ||
if(success) { | ||
return `Success ${this.operation}`; | ||
return this.translations.success_operation(this.operation); | ||
} | ||
return `Error ${this.operation}`; | ||
return this.translations.error_operation(this.operation); | ||
} | ||
} | ||
import { LitElement, html } from 'lit'; | ||
import { DileAxios } from '../../../lib/DileAxios.js'; | ||
import { DileI18nMixin } from '../../../lib/DileI18nMixin.js'; | ||
export class DileAjax extends DileAxios(LitElement) { | ||
export class DileAjax extends DileAxios(DileI18nMixin(LitElement)) { | ||
static get properties() { | ||
@@ -58,3 +59,3 @@ return { | ||
} else { | ||
this.dispatchError('Unhandled success server response'); | ||
this.dispatchError(this.translations.http_unhandled_success); | ||
} | ||
@@ -79,22 +80,25 @@ }) | ||
} else { | ||
this.dispatchError("Not found error"); | ||
this.dispatchError(this.translations.http_404); | ||
} | ||
break; | ||
case 401: | ||
this.dispatchError('Unauthorized. Your session may have expired'); | ||
this.dispatchError(this.translations.http_401); | ||
break; | ||
case 405: | ||
this.dispatchError(this.translations.http_405); | ||
break; | ||
case 419: | ||
this.dispatchError('Your session has expired. Please refresh the page'); | ||
this.dispatchError(this.translations.http_419); | ||
break; | ||
case 502: | ||
this.dispatchError('Connection error, invalid gateway'); | ||
this.dispatchError(this.translations.http_502); | ||
break; | ||
case 504: | ||
this.dispatchError('Connection timeout with the gateway'); | ||
this.dispatchError(this.translations.http_504); | ||
break; | ||
default: | ||
this.dispatchError('Action not completed due to a server error'); | ||
this.dispatchError(this.translations.http_other_error); | ||
} | ||
} else { | ||
this.dispatchError('No response received from the server'); | ||
this.dispatchError(this.translations.http_no_response); | ||
} | ||
@@ -101,0 +105,0 @@ } |
{ | ||
"name": "@dile/crud", | ||
"version": "0.0.27", | ||
"version": "0.0.28", | ||
"description": "Components to create a generic crud system based on Web Components and Lit", | ||
@@ -34,3 +34,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "447a6986de20316e3d58fbc03f8b07f871b88be7" | ||
"gitHead": "f656c500a94dd5ca9157ac2af010d0881047ddf6" | ||
} |
102290
83
3167