@praxisui/core 1.0.0-beta.3 → 1.0.0-beta.5
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.
|
@@ -1127,20 +1127,14 @@ class GenericCrudService {
|
|
|
1127
1127
|
const schemaId = buildSchemaId({ path, operation, schemaType, includeInternalSchemas: false, tenant, locale, apiOrigin });
|
|
1128
1128
|
const headersBase = composeHeadersWithVersion(entry);
|
|
1129
1129
|
return from(this._schemaCache.get(schemaId)).pipe(concatMap((cached) => {
|
|
1130
|
-
let headers = headersBase;
|
|
1130
|
+
let headers = (headersBase instanceof HttpHeaders ? headersBase : new HttpHeaders(headersBase));
|
|
1131
1131
|
if (cached?.schemaHash) {
|
|
1132
|
-
headers = (
|
|
1133
|
-
.set('If-None-Match', `"${cached.schemaHash}"`)
|
|
1134
|
-
.set('Accept-Language', locale || '')
|
|
1135
|
-
.set('X-Tenant', tenant || '');
|
|
1136
|
-
}
|
|
1137
|
-
else {
|
|
1138
|
-
headers = (headersBase instanceof HttpHeaders ? headersBase : new HttpHeaders(headersBase));
|
|
1139
|
-
if (locale)
|
|
1140
|
-
headers = headers.set('Accept-Language', locale);
|
|
1141
|
-
if (tenant)
|
|
1142
|
-
headers = headers.set('X-Tenant', tenant);
|
|
1132
|
+
headers = headers.set('If-None-Match', `"${cached.schemaHash}"`);
|
|
1143
1133
|
}
|
|
1134
|
+
if (locale)
|
|
1135
|
+
headers = headers.set('Accept-Language', locale);
|
|
1136
|
+
if (tenant)
|
|
1137
|
+
headers = headers.set('X-Tenant', tenant);
|
|
1144
1138
|
console.debug('[CRUD:Service] getSchema (filtered fallback):request', { filteredUrl, path, hasCached: !!cached });
|
|
1145
1139
|
return this.http.get(filteredUrl, { params: httpParams, headers, observe: 'response' });
|
|
1146
1140
|
}), concatMap((resp) => {
|
|
@@ -1217,9 +1211,9 @@ class GenericCrudService {
|
|
|
1217
1211
|
catch { }
|
|
1218
1212
|
return of(this.schemaNormalizer.normalizeSchema(body));
|
|
1219
1213
|
}),
|
|
1220
|
-
// Angular HttpClient treats 304 as error; handle
|
|
1214
|
+
// Angular HttpClient treats 304 as error; also handle status 0 (CORS/network) by reusing cache
|
|
1221
1215
|
catchError((err) => {
|
|
1222
|
-
if (err?.status === 304) {
|
|
1216
|
+
if (err?.status === 304 || err?.status === 0) {
|
|
1223
1217
|
return from(this._schemaCache.get(schemaId)).pipe(concatMap((cached) => {
|
|
1224
1218
|
if (cached?.schema) {
|
|
1225
1219
|
try {
|
|
@@ -1437,9 +1431,9 @@ class GenericCrudService {
|
|
|
1437
1431
|
this._schemaCache.set(schemaId, entryToCache);
|
|
1438
1432
|
return of(this.schemaNormalizer.normalizeSchema(body));
|
|
1439
1433
|
}),
|
|
1440
|
-
// Angular HttpClient may surface 304 as error; handle
|
|
1434
|
+
// Angular HttpClient may surface 304 as error; also handle status 0 (CORS/network) by reusing cache
|
|
1441
1435
|
catchError((err) => {
|
|
1442
|
-
if (err?.status === 304) {
|
|
1436
|
+
if (err?.status === 304 || err?.status === 0) {
|
|
1443
1437
|
return from(this._schemaCache.get(schemaId)).pipe(concatMap((cached) => {
|
|
1444
1438
|
if (cached?.schema) {
|
|
1445
1439
|
try {
|