Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Mar 14, 2023
1 parent 9261fc5 commit 681b823
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
### 2.2.0

- parseLoadPayload for POST request [110](https://github.com/i18next/i18next/pull/110)

### 2.1.1

- regression fix for saveMissing [signature](https://github.com/i18next/i18next/issues/1890)
- regression fix for saveMissing signature [1890](https://github.com/i18next/i18next/issues/1890)

### 2.1.0

Expand Down
8 changes: 7 additions & 1 deletion i18nextHttpBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ var getDefaults = function getDefaults() {
parsePayload: function parsePayload(namespace, key, fallbackValue) {
return _defineProperty({}, key, fallbackValue || '');
},
parseLoadPayload: function parseLoadPayload(languages, namespaces) {
return undefined;
},
request: _request.default,
reloadInterval: typeof window !== 'undefined' ? false : 60 * 60 * 1000,
customHeaders: {},
Expand Down Expand Up @@ -120,7 +123,10 @@ var Backend = function () {
key: "loadUrl",
value: function loadUrl(url, callback, languages, namespaces) {
var _this3 = this;
this.options.request(this.options, url, undefined, function (err, res) {
var lng = typeof languages === 'string' ? [languages] : languages;
var ns = typeof namespaces === 'string' ? [namespaces] : namespaces;
var payload = this.options.parseLoadPayload(lng, ns);
this.options.request(this.options, url, payload, function (err, res) {
if (res && (res.status >= 500 && res.status < 600 || !res.status)) return callback('failed loading ' + url + '; status code: ' + res.status, true);
if (res && res.status >= 400 && res.status < 500) return callback('failed loading ' + url + '; status code: ' + res.status, false);
if (!res && err && err.message && err.message.indexOf('Failed to fetch') > -1) return callback('failed loading ' + url + ': ' + err.message, true);
Expand Down
Loading

0 comments on commit 681b823

Please sign in to comment.